How to get "I'm Feeling Lucky" search to Firefox addressbar

Fri, 2011-10-07 07:05

Firefox 7 is just released and today, I upgraded to Firefox 8 beta. Unfortunately, my beloved add-on LuckyBar is not compatible with Firefox 8 yet.

So I said good bye to LuckyBar add-on and invented my own way to get Google's "I'm Feeling Lucky" to Firefox.

Google's "I'm Feeling Lucky" search query pattern is so simple. You only have to add btnI=1 param to the request URL. For an example, if you needed to search Google for "Apple", search URL is http://google.com/search?q=Apple. But if you need to fire an "I'm Feeling Lucky" search, request URL should be http://google.com/search?btnI=1&q=Apple.

That being said, if we changed Firefox's default addressbar-search-engine to the pattern above, it will replicate an I'm feeling lucky search right from the address bar.

To do so, open a new tab in Firefox and then type about:config in the address bar, and hit Enter key. You will get a warning message - go ahead.
Now, type keyword.url in the text box and double click on the shown entry Keyword.URL. You will get a dialog box to enter w search URL pattern. Type http://google.com/search?btnI=1&q= in the text box and click OK.
It's Done.

Now, when you type something such as "Mozilla", "Ayesh", "Youtube" or something else, you will be taken to the first Google search result automatically, from Google's "I'm Feeling Lucky" search!

Update: From Firefox 23, this will no longer work because of the change specified in the issue 738818. To get this feature back, I had to install the little yet awesome addon named Keyword.URL Hack.

Update 2: From Firefox 53, you can use Web Extensions. Legacy addons have stopped working since Firefox 57. For Firefox 53+, you can use Keyword Search Web Extension to achieve the same functionality. Thanks to Tom for referring this great compilation of Web Extension addons along with replacements for legacy addons.