Changing autocomplete behavior - Firefox

From MozillaZine Knowledge Base
Revision as of 12:01, 6 October 2009 by Alice Wyman (talk | contribs) (→‎Firefox 3.5: added that autocomplete must be enabled to change autocomplete behavior via "browser.urlbar.default.behavior" in about:config)
Jump to navigationJump to search

The Location Bar (also called the URL or address bar), the Search Bar, and some form fields on web pages have autocomplete dropdowns that appear with a list of previously-entered data.

  • To disable autocomplete in form fields and the Search Bar, go to "Tools -> Options -> Privacy" and clear to checkbox, "Remember what I enter in forms and the search bar." For more information, see Form autocomplete at Firefox Support.

Location Bar autocomplete is an integral part of the History mechanism and persists for the same duration as History items. In Firefox 2, the only way you can fully disable Location Bar autocomplete is by disabling History; this can be done by changing the Privacy setting, "Remember visited pages" to zero. Starting in Firefox 3, however, this only prevents additional History items from accumulating (bug 366075) and the Firefox 3 Location Bar ("Smart Location Bar") will still display bookmarks in the autocomplete drop down list, even if you clear the browsing history.

To modify or disable the display of autocomplete entries in the Location Bar, use the methods described below.

Changing autocomplete behavior

Applies to Firefox 3 and above

The default behavior for Location Bar autocomplete in Firefox 3.0 and above is to display all results from both bookmarked items and your browsing history of visited pages. This behavior can be modified as follows.

Firefox 3.0

In Firefox 3.0, to only show those entries from History or bookmarked items that you have specifically typed into the Location Bar (url bar) , toggle the preference browser.urlbar.matchOnlyTyped to true in about:config. To completely disable the Location Bar autocomplete function, modify the preference browser.urlbar.maxRichResults to 0 (zero). [1] For additional information about modifying the "Smart Location Bar" behavior in Firefox 3, see the MozillaZine forum topic, Customising the Firefox 3 Location Bar and this forum post.

Firefox 3.5

In Firefox 3.5, you can change Location Bar autocomplete behavior in "Tools -> Options -> Privacy / Location Bar" by selecting one of the options in the "When using the location bar, suggest:" drop-down menu:

  • History and Bookmarks (default) - Displays both visited pages in history and bookmarked items (no filtering)
  • History - Restricts results to visited pages in history
  • Bookmarks - Restricts results to bookmarked items
  • Nothing - No autocomplete results are displayed

Selecting "Nothing" sets the preference browser.urlbar.autocomplete.enabled to false and completely disables Location Bar autocomplete. Selecting "History and Bookmarks", "History", or "Bookmarks" enables autocomplete (if disabled) and sets a corresponding value in the preference browser.urlbar.default.behavior.

As long as autocomplete is enabled, you can also change autocomplete Location Bar behavior using about:config, by changing the browser.urlbar.default.behavior preference value . For example, setting the value to 1 restricts results to visited pages in history, setting the value to 2 restricts results to bookmarked items, and resetting the preference restores the default value 0 (no filtering). You can also restrict autocomplete results to tagged items (value = 4) or to typed items (value = 32) or you can match only the title (value = 8) or the URL (value = 16). You can also add filters together in various combinations, such as setting the value to 3 (1+2) to display only visited bookmarks; or, setting the value to 17 (1+16) to display only visited pages with a URL match; or, setting the value to 49 (1+16+32) to display only visited pages with a URL match for typed items. See the article browser.urlbar.default.behavior for more information. [2]

Preventing autocomplete display with UserChrome.css

Applies to Firefox 2 and below

Note that this method does not actually delete the internal lists of previously-entered data; it merely prevents their display. The method below has some problems. It will cause some errors appear in the JavaScript Console if you have chrome errors enabled, and in some circumstances it may cause the browser to malfunction.

In userChrome.css, add the following lines:

/* Remove autocomplete dropdown */
#PopupAutoComplete > .autocomplete-tree { display: none !important; }

If you also want to remove the dropdown button at the far right of the Location Bar, add the following lines:

/* Remove the drop arrow in the Location (URL) Bar */
.autocomplete-history-dropmarker { display: none !important; }

You may also want to enable inline autocomplete.

See also

External links

Related bug reports