15 February 2009 - 12:30Hiding History with userChrome
Josh had an interesting comment in my recent post on Firefox 3.1 Location Bar Preferences about hiding certain keywords from the location bar.
At first I suggested using the new “Forget About This Site” feature where you can select a page from your History Sidebar and choose to forget everything (history, cookies, etc) about that site. Doing this would prevent any of those pages from showing up in the location bar because you would have no history for that site.
Unfortunately, that requires the user to actively clear the site from his/her history. (Perhaps Firefox could automatically do that for the user in a privacy-aware manner…)
Josh then had a question regarding userChrome. Since Firefox 3 handles all sorts of fancy CSS 3 selectors including substring matching in attributes with *=, I figured it would be fairly simple to match the url or title of a location bar result and hide it.
This technique works well if you don’t mind leaving trails of your privacy hiding in plain sight. However, I suppose the ease of taking a peek at userChrome is a quite bit more difficult than just typing in the location bar.
All you need to do is use your favorite way to style Firefox, e.g., editing userChrome.css in your profile’s chrome directory or through an add-on, and add a style matching the class name “autocomplete-richlistitem” as well as a selector for either the “url” or “title” attributes.
For example, if you want to block any results that have “facebook” anywhere in the URL, use the following style:
.autocomplete-richlistitem[url*="facebook"] { display: none; }
This is just a simple hack to prevent certain pages from showing up. The location bar by default tries to show the top 12 pages, but if you’re hiding pages, you might end up with no results. You can try changing the value of browser.urlbar.maxRichResults from about:config to get more results, so if any get hidden, there are others to fill in the space.
15 Comments | Tags: AwesomeBar, Mozilla