Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm making a little script with Autohotkey to quickly go to the first Google result of a search term. My problem is, the only method I've found for doing this though the URL is acting a little inconsistent.

This only works when the first hit is deemed to be a very good match. Otherwise Google shows the normal 10 results. However, the actual "I'm Feeling Lucky" button on their front pages always takes you to the first result.

Try these links:          <- works  <- doesn't work

"new york dijon" on the front-page and then hitting "I'm Feeling Lucky" does work though.

Any idea how I can get it to consistently work in URL form?

Edit: Okay, seems this might not be doable in a single URL. I'll mark a greasemonkey-script workaround as correct if posted.

share|improve this question
+1 for an interesting and well-written question – BrianAdkins Dec 31 '13 at 1:51
These fail:,,‌​on – Ivan Chau Dec 31 '13 at 3:59
I guess the safe search functionality hinders the feature. – Ivan Chau Dec 31 '13 at 4:19
I'm going to try seeing how the HTML form is set up in Firefox with Noscript enabled. – Just Jake Jan 7 '14 at 11:17
This article might also interest you. According to it, it works with 2 keywords, but not 3. And even then somehow, not always ;( I think btnI works with up to 2 keywords AND if Google does not decide you might have typed something wrong (like Did you mean: geeks alive). Otherwise a bit of javascript is used to redirect you. – Rik Jan 7 '14 at 12:22

When you have Javascript disabled, it seems that Google uses both a cookie and the HTTP Referrer header being set to to track if you actually came from the Google home page and clicked the "I'm Feeling Lucky" button. I don't think you'll be able to convince Google to hand you the lucky result with just a URL.

share|improve this answer
up vote 0 down vote accepted

Made a workaround Greasemonkey script:

// ==UserScript==
// @name         Google IFL
// @match        https://**?lucky=*
// @match        http://**?lucky=*
// ==/UserScript==

document.getElementById("gsr").style.display = 'none'; // optional. shows blank screen before forwarding. just looks better imo.
var pathname = document.URL;
var start = pathname.indexOf("?lucky=");
var searchterm = pathname.substring(start+7);
document.getElementById("gbqfq").value = decodeURI(searchterm);
var btnLucky = document.getElementsByName('btnI')[0];;

This script will always forward you to Google's "I Feel Lucky" choice provided you navigate to

I'm using it in FireFox by having a keyword to a bookmark going to

share|improve this answer

The best solution I've come up with is: Chrome > Preferences > Manage Search Engines... add:

  • Search Engine: I'm Feeling Lucky
  • Keyword: \ (replace with your preferred shortcut)
  • URL: {google:baseURL}search?q=%s&btnI

Then as per this thread, add the following Greasemonkey / Tampermonkey script to reload the page with Google as the referrer.

// ==UserScript==
// @name         I'm feeling lucky fix
// @version      0.0
// @description  Makes Google I'm feeling lucky work reliably from the address bar
// @author       Will Rice
// @match        http://**&btnI
// @match        https://**&btnI
// @match        http://**&btnI
// @match        https://**&btnI
// ==/UserScript==

document.getElementsByTagName("body")[0].style.display = "none";
window.location.href = location;

Setting the script to "run at body" and adding any additional Google TLDs as you see fit (I couldn't get regex working in Tampermonkey).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .