Google Chrome automatically adding websites to my list of search engines?

122

52

I have noticed that certain websites (e.g. Stack Exchange sites, Dell, etc.) are automatically added to my list of search engines in Google Chrome.

They even add a keyboard shortcut to their entry. Here are some examples:

  • Dell: Keyboard -> Dell.com
  • Stack Exchange Web masters: Keyboard -> webmasters.stackexchange.com
  • Reuters: Keyboard -> reuters.com

Q1: Is this the default behavior in Chrome? (to let websites add themselves to the list of search engines?)

Q2: Is it possible to disable this behavior in Chrome?

Note: I'm running the latest version of Chrome: 11.0.696.57 on Windows 7 64, and I only have one extension installed: Google URL shortener.

Amelio Vazquez-Reina

Posted 2011-04-27T15:44:26.697

Reputation: 5 686

1It seems like I am not worthy of deciding myself which search engines my browser should be aware of. – Anders Lindén – 2019-03-01T10:14:47.337

33@ Sathya, Why? I want to have the flexibility to disable it. If your question is why would I disable something like this: the interface to edit search engines is not particularly good, and as the list grows it's hard tell which search engines I added manually and which ones were added automatically. It's also harder to find a particular entry within a large list. – Amelio Vazquez-Reina – 2011-04-27T17:41:24.213

16@Sathya - Many reasons: * Convenience: Sometimes you want to search ABOUT a site, rather than ON that site. * Consistency: Randomly and silently adding new "search engines" causes unexpected behavior in the omnibox. * Privacy: Chrome does not inform you when it decides to add new "search engines," and they don't go away when you clear your browsing history. * Common courtesy: Shouldn't I be able to choose whether to enable this "feature" is enabled, or—failing that—at least choose to be informed when Chrome decides to add a site, so I can countermand this decision? – phenry – 2011-10-28T17:43:20.573

Answers

34

Thanks to @10basetom's code and inspired by @shthed, I've released the Don't add custom search engines Chrome extension which does just that.

You'll find the source code here.

Let me know what you think!

Greg Sadetsky

Posted 2011-04-27T15:44:26.697

Reputation: 557

Working fine for me. My search engines list is still pleasingly empty (except for the default google). Awesome. – O'Rooney – 2016-07-13T21:59:13.977

1@O'Rooney Thank you! I see some sites slip by the extension from time to time, but it's much better cleaning out a few search engines in a month than having to do an almost complete weekly "purge"... Cheers! – Greg Sadetsky – 2016-07-14T14:04:52.797

Thanks! This is the best way to do it. I was concerned that an extension might not be able to reach far enough into the browser to do it, so I'm glad those concerns were unfounded. – Rook – 2016-08-31T06:35:20.663

This is excellent and much needed, thank you! – orschiro – 2016-10-23T07:15:35.133

4Does not actually work anymore: a lot of custom search engines still end up being added. – onnodb – 2017-12-03T19:11:57.560

1@onnodb thanks for the note, I have unfortunately not had enough time to update the extension. – Greg Sadetsky – 2017-12-07T11:00:47.460

1

@onnodb, Greg, would you (or any others interested) please try out this fork? Check out, then load .../src as an unpacked extension. Let me know how it goes. Thanks!

– cxw – 2018-03-07T18:49:34.740

3Small note that the extension has just been updated with a much improved detection/blocking algorithm, thanks to many efforts from a number of contributors! Give it a ago if it was not working well for you earlier. Cheers – Greg Sadetsky – 2018-03-19T19:04:07.557

61

This was making me absolutely insane, so I found a hackish, but effective solution to the issue.

Chrome stores it's search engines in a simple sqlite3 database. I found that you can create a trigger when chrome goes to add the search engine that causes the database insert statement to be ignored.
Note that the search engines are still kept in memory, so they will still show up in the list until the browser is restarted. However you wont have to clear them out all the time, and so if you want to add your own search engines, you won't have to worry about accidentally deleting them (yes, manually adding search engines will still work).

First you must locate the Web data file.

  • Mac OS X: ~/Library/Application Support/Google/Chrome/Default/Web Data

  • XP: C:\Documents and Settings\<username>\Local Settings\Application Data\Google\Chrome\User Data\Default\Web Data

  • Vista/7: C:\Users\<username>\AppData\Local\Google\Chrome\User Data\Default\Web Data

  • Linux: ~/.config/google-chrome/Default/Web Data or ~/.config/chromium/Default/Web Data

Then open it with an sqlite3 editor.

Chrome must be shut down at this point.

The official sqlite web site has a download page with a pre-compiled command line utility for the various operating systems. Though any editor capable of working with sqlite3 databases will work.

For the command line utility, use a command such as the following (don't forget to escape or quote the space in the file name):

sqlite3 /path/to/Web\ Data

Add the trigger.

CREATE TRIGGER no_auto_keywords BEFORE INSERT ON keywords WHEN (NEW.originating_url IS NOT NULL AND NEW.originating_url != '') BEGIN SELECT RAISE(IGNORE); END;

You're done. Close the editor and start chrome back up.


The way it works is that when chrome goes to add auto-add a search engine to the keywords table, chrome sets the originating_url field to the web site it came from. The trigger basically looks for any inserts with a non-empty originating_url field, and issues a RAISE(IGNORE) which causes the statement to be silently skipped.
Manually added search engines don't have an originating_url, and so the trigger allows them to be added.

Patrick

Posted 2011-04-27T15:44:26.697

Reputation: 905

1This is great and it works. However, for me, Chrome still added search engines, not in the database, but in another folder, "Sync Data Backup". Disable write permissions for that folder in Windows/Linux and it will be gone for good. – Martin Hansen – 2014-09-13T10:01:43.137

This doesn't appear to work anymore, at least in Chrome v47beta. After restarting Chrome, the auto-added search engine is still in the list, although typing the keyword doesn't trigger it anymore. – thdoan – 2015-11-06T03:34:54.503

FYI: 1/ make a copy of this file first in case you mess it up :) 2/ on Mac 10.11.4 (El Capitan) I was unable to open the file/database with sqlitebrowser.app ("Error: unable to open database "~/Library/Application Support/Google/Chrome/Default/Web Data": unable to open database file). 3/ if you try and run the CREATE TRIGGER command whilst Chrome is open, you get Error: database is locked so exit Chrome first. 4/ once Chrome was closed, this opened the database successfully worked: /Volumes/Macintosh\ HD/Applications/sqlite3 ./Web\ Data (in Terminal, when in specified directory) HTH – sming – 2016-04-07T12:26:17.187

I tried delete from keywords where id > 2; and google just syncs them back from server. I guess it's too late after I already have thousands of searchengines installed. – Qi Fan – 2016-10-18T22:58:57.703

@10basetom worked for me on version 55 – None – 2017-02-22T00:43:50.777

Very cool, Patrick. And thank you @mateuscb; SQLiteStudio was very helpful in seeing and understanding what I was doing (and allowed me to export a backup sql query of my keywords table, which I then used to import into other Chrome profiles). – Ryan – 2017-05-21T16:02:57.353

It should be noted, that in the newer version of Chrome, you will need sqlite3, as sqlite itself will error out saying Web Data is either not a database, or is encrypted. Solution still works, just need the correct version of sqlite ;) – Alex Summers – 2017-09-26T23:31:44.460

Did not work for me on version 62.0.3202.94. – zionyx – 2017-12-08T09:40:32.103

2

After trying a few editors out, SQLiteStudio my favorite. No way am I related to this product. Just a useful tool I found after some searching.

– mateuscb – 2014-03-14T21:55:32.670

35

There are two ways to do this:

  1. Add this userscript to Tamper Monkey:

    var elOpenSearch = document.querySelector('[type="application/opensearchdescription+xml"]');
    if (elOpenSearch) elOpenSearch.remove();
    
  2. If you're not a regular Tamper Monkey user and don't feel like wasting 15-20 MB of RAM just to load the Tamper Monkey extension for this purpose, then you can roll your own super lightweight extension that won't consume any memory. Instructions are provided below.

How to create your own extension to remove the OpenSearch <link> tag and prevent Chrome from auto-adding search engines:

  1. Create a folder where you will be putting the extension files.

  2. Inside this folder, create two text files named manifest.json and content.js containing the code provided below.

    manifest.json

    {
      "manifest_version": 2,
      "name": "Disable OpenSearch",
      "version": "1.0.0",
      "description": "Remove the OpenSearch <link> tag to prevent Google Chrome from auto-adding custom search engines.",
      "content_scripts": [
        {
          "matches": ["<all_urls>"],
          "js": ["content.js"]
        }
      ],
      "permissions": [
        "http://*/*",
        "https://*/*"
      ]
    }
    

    content.js

    var elOpenSearch = document.querySelector('[type="application/opensearchdescription+xml"]');
    if (elOpenSearch) elOpenSearch.remove();
    
  3. In Chrome, go to chrome://extensions/ (enter this into the URL bar).

  4. Enable Developer Mode.

  5. Click on 'Load unpacked extension', select the folder you created in step 1, and click 'OK'.

Congratulations! Now Google Chrome should be a little less annoying to use :-).

Limitation: This solution is not 100% reliable. If you go to a URL that contains a search parameter (e.g., https://cdnjs.com/#q=fastclick), then in rare cases a custom search engine will still be added. I suspect this is because Chrome can parse the OpenSearch <link> tag before the userscript or extension has a chance to remove it from the DOM.

thdoan

Posted 2011-04-27T15:44:26.697

Reputation: 641

2I'm surprised nobody has posted this as an official extension to the store, seems like it would be popular. Ideally I'd like an extension to ask me before adding a search engine, or have an icon in the address bar that lets me add it, just like RSS feeds. – ryanmonk – 2016-02-21T04:27:08.753

7

Thanks for the great code and @shthed thanks for the inspiration! I've just released a Google Chrome Extension which does just that. You can find it here. Source code here. Let me know what you think! :-)

– Greg Sadetsky – 2016-03-31T18:03:44.660

@GregSadetsky Post this as an answer and we could vote for it :) – O'Rooney – 2016-07-12T04:51:01.167

24

  1. Yes, this is by design.
  2. No, there's no way to disable this.

Sathyajith Bhat

Posted 2011-04-27T15:44:26.697

Reputation: 58 436

8Yet there are ways to disable it, as other answers explain :) – Enrico – 2017-03-11T14:25:54.963

6"Yes, this is by design." It's a poor and improper design to automatically add things to a system without the users input on the matter. Malicious websites could easily take advantage of this.

"No, there's no way to disable this." Obviously there is, when it is software, there is always a way. Being lazy and saying there isn't, is not a solution. This answer should be removed, and the writer warned. – Alex Summers – 2017-09-26T23:18:53.000

My custom search engine lost after a cache clear. I have opened some sites for hours but these engines didn't go back. Do you know how to get them back ?(I don't want to add them manually, too many ) – Mithril – 2019-01-22T01:52:11.060

this wrong answer gets upvoted. Shouldn't it be deleted, or edited to correct it? – Santropedro – 2019-03-10T02:02:42.910

2I love this answer. This is simple but informative – Dzung Nguyen – 2012-05-09T14:03:14.870

10

Here a somewhat hacky workaround which works just fine for me. Just rename the search alias to something cryptic like "§$%!/()&/". While the search engine is still there you won't see it again, ever. Pretty annoying if you can't google for "jenkins" because chrome forces you to search in jenkins.

atamanroman

Posted 2011-04-27T15:44:26.697

Reputation: 263

2It does this to me for jenkins, jira, and confluence - It drives me absolutely crazy that I can not initiate a general search from my address bar for anything related to these three. This, is by far the best and only working workaround I have seen. Cheers. – Matt Clark – 2015-08-04T22:35:46.247

1@MattClark jira exactly! I want to search about jira, not in it! – ErikE – 2015-09-23T18:22:03.430

How is it behaving in your case? For me, to trigger the search on site, I have to type its keyword into omnibar a press Tab. Then it changes into the on site search and I can continue to type the search string. If I want to search just the keyword or a string containing the keyword, I type the keyword, Space, rest of the search string and Enter and I'm searching using the default search engine. So it doesn't interfere with each other. Just use the Space after the keyword to search using the default search engine and the Tab to search on site. – Dawid Ferenczy Rogožan – 2016-12-12T16:37:28.640

@DawidFerenczy: That's not how it works for the rest of us. A space still uses that search engine. I type in git, then a space and it instantly changes to use git's search engine (which I've removed countless times). – Gerrat – 2017-04-24T18:30:43.267

If you start your search with a ? then it will search Google by default. For example ?jira or ?jenkins. – Eric Seastrand – 2018-04-16T14:01:42.603

Seriously - crazy annoying. Thanks for the tip. – TJ Biddle – 2013-06-03T23:06:12.833

9

To quickly remove large numbers of search engines, browse to chrome://settings/searchEngines, hit Ctrl-Shift-J (Opt-Cmd-J on OSX) to enter the Javascript console, and paste this:

settings
    .SearchEnginesBrowserProxyImpl
    .prototype
    .getSearchEnginesList()
    .then(function (val) {
        val.others.sort(function (a, b) { return b.modelIndex - a.modelIndex; });
        val.others.forEach(function (engine) {
            settings
                .SearchEnginesBrowserProxyImpl
                .prototype
                .removeSearchEngine(engine.modelIndex);
        });
    });

You may need to paste and run this a few times to clear everything.

alcohol

Posted 2011-04-27T15:44:26.697

Reputation: 191

I had to copy/paste this about 10 times into the dev-console to remove the 100+ entries I had. Wish I knew how to turn it into a single-click bookmarklet. – jiggunjer – 2017-09-07T08:31:51.520

1I modified it to sort the list in reverse first (based on modelIndex), since its value gets reset each time an entry gets deleted (so you usually end up deleting around half of the current list only) when working from top to bottom. When working from bottom to top, this issue does not occur. – alcohol – 2017-11-07T15:10:12.893

First one I saw that can do this in one run! Kudos. – bnieland – 2017-12-22T14:37:15.350

Worked in one run on my Windows 10, version 1709 installation of Chrome Version 64.0.3282.186 (Official Build) (64-bit). – JosephHarriott – 2018-03-02T05:53:25.487

9

Try using this simple userscript:

// ==UserScript==
// @name       Block Opensearch XML specs
// @namespace  *
// @version    0.3
// @description  Block opensearch xml links
// @match      *
// @copyright  2012+, Christian Huang
// ==/UserScript==

var i;
var val;
var len;
var opensearches;

opensearches = document.getElementsByTagName('link');
len = opensearches.length;
for (i = 0; i < len;i++) {
    val = opensearches[i].type;
    if ( val == "application/opensearchdescription+xml") {
        opensearches[i].parentNode.removeChild(opensearches[i]);
    }
}

ythuang

Posted 2011-04-27T15:44:26.697

Reputation: 91

1Or, you can use it in Tamper Monkey. If you're used to making modifications to websites, TM should be a must-have addon. – JasonXA – 2014-12-28T17:19:41.113

You can also use this one-liner: document.querySelector('[type="application/opensearchdescription+xml"]').remove(); (see my answer below). – thdoan – 2015-11-06T06:12:26.493

This is great, thanks. It might be even better if you hosted this script somewhere public (e.g. github) and then included a @downloadURL header pointing to it. Then people could receive updated versions with a single click. – Adam Spiers – 2016-09-26T08:33:23.470

1where do add this script? or execute it? – mateuscb – 2014-03-14T21:23:15.227

2

@mateuscb You can get it from here. Then just drop the script in the extensions settings page in chrome, chrome://extensions/.

– Victor Häggqvist – 2014-05-14T14:39:31.593

This. Is. Awesome. I needed to create a dummy manifest.json (as per this SO answer and install it via dev mode (as an unpacked extension), but apart from that it worked like a treat.

– womble – 2014-06-11T05:58:16.553

7

If I'm understanding what you're describing correctly, then this isn't the websites doing anything at all. Rather, Chrome itself identifies search boxes on websites and then itself adds those to its list of search options in the omnibar.

A1: Yes, this is default behavior, but it's not the websites adding themselves, it's Chrome adding the websites.

A2: I do not believe you can disable this behavior, however you can remove search engines by going to the tool menu -> Options -> Manage Search Engines; they will appear under "Other Search Engines". You may be able to specify that one should not be re-added when you remove it, I'm not sure -- I happen to like this feature, so I'm not going to try removing them.

Kromey

Posted 2011-04-27T15:44:26.697

Reputation: 4 377

1

This answer is incorrect, websites do effectively add themselves to Chrome as they use what is called an OpenSearch description document to enable Chrome to add their website's search engine to Chrome's list of search engines your browser can interface with.

– Marcel – 2015-06-11T12:01:46.997

@Marcel OpenSearch merely lets sites describe their search feature. It still requires the browser to act upon that. Therefore this is not incorrect, I just didn't include the technical spec that's being used to "...[identify] search boxes on websites..." in my answer, as I felt it would have complicated an otherwise-simple matter -- the exact mechanism of how the browser finds a search box isn't relevant to the average user, only to webmasters who want theirs to be added. – Kromey – 2015-06-11T16:35:02.527

Thanks @Kromey, That's a good point. I just updated the question to reflect your comment. – Amelio Vazquez-Reina – 2011-04-27T17:49:53.360

7

One workaround I've found for this is to acquire the habit of starting all my searches with a space. If you type ・Splunk median (where represents the space character), Chrome will perform a Google search on Splunk median.

Jun-Dai Bates-Kobashigawa

Posted 2011-04-27T15:44:26.697

Reputation: 171

1For me it didn't work. On Chrome 39, Win 7, typing spacekeyword didn't bring up the search interface. However, your solution was useful elsewhere, in naming. If I want my defined searches to appear on top of the automated ones, one space in front of the name and presto. All automated search engines go below and now it's easier to manage / remove them. – JasonXA – 2014-12-28T17:21:46.857

just press ctrl+k to get that behavior. – jiggunjer – 2017-09-07T08:25:14.683

2Starting the search with a question mark (?) will also use your default search engine. – Ari – 2014-05-30T02:07:46.053

Nice! I like that better than the space. – Jun-Dai Bates-Kobashigawa – 2014-05-30T14:34:11.187

6

<-- Background -->

I have an alternate, less-intrusive idea for you here (at least if you're running an ad blocker, as so many of us are for our own sanity/safety). I like using existing extensions/scripts as much as possible to avoid the bloat of a whole extension for just one feature (worst-case scenario) so this solution works under this principle.

Adblock, and its variants/successors (uBlock is my weapon of choice), have the ability to block web page elements, including <link> elements, which is used for autodiscovery of OpenSearch Descriptions (OSDs), the XML files that contain the information which permits auto-adding search engines and causes us these headaches. I say "permits" because it's hardly mandatory, as, so far as my research has shown, Firefox simply reads this information and makes it available for easy addition under the Search Engines dropdown box, rather than quietly auto-adding it like Chrome does.

The use of the feature is described in the Opensearch specifications in multiple places:

http://www.opensearch.org/Specifications/OpenSearch/1.1#Autodiscovery_in_RSS.2FAtom (ignore the specific subtltle of this section for our purposes as it's just an example of it in use)


<-- The Solution -->

As it states that OpenSearch Descriptions (OSDs) have a unique type, we can filter them out with the following AdblockPlus/uBlock rule:

##link[type="application/opensearchdescription+xml"]

I've tested this and the rule shows the correct match on my test sites (filehippo.com etc) and the search engines are no longer auto-adding, so I believe this is a full solution.


A quick note on the history I've found behind this: Chromium's engineers have labeled this "WontFix" several times over the years (a power-user disable option/flag was requested multiple times) stating that this is considered a niche issue since the feature is "generally useful", their stance is that niche issues should be solved by extensions or 3rd-party scripts rather than by the devs adding countless flags and the like to cater to all whims, so basically what we're doing here is just in line with their preference and keeps it nice and manageable.

Best of luck! If anyone else tries this let us/me know how it works!

Rook

Posted 2011-04-27T15:44:26.697

Reputation: 408

1

This didn't work for me (try searching on https://cdnjs.com/). I've come to the conclusion that there is no 100% reliable solution :(

– thdoan – 2015-11-06T03:46:09.270

This isn't working for me either - if I search on https://www.4inkjets.com/ it gets added as a search engine (strangely, I cannot find a application/opensearchdescription+xml link on the page.)

– Ivan Kozik – 2017-09-26T23:58:47.153