Consistent I'm Feeling Lucky macro for Google












12














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.



http://www.google.com/search?q=searchterm&btnI=745


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:



http://www.google.com/search?q=new%20york&btnI=745          <- works
http://www.google.com/search?q=new%20york%20dijon&btnI=745 <- 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
























  • These fail: google.com/search?q=new%20york%20dijon&btnI=Im+Feeling+Lucky, google.com/search?btnI=1&q=new%20york%20dijon, google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=new%20york%20dijon
    – 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












  • @JustJake, the lucky button contains a non-standard attribute: jsaction="sf.lck".
    – Synetech
    Jan 8 '14 at 1:13
















12














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.



http://www.google.com/search?q=searchterm&btnI=745


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:



http://www.google.com/search?q=new%20york&btnI=745          <- works
http://www.google.com/search?q=new%20york%20dijon&btnI=745 <- 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
























  • These fail: google.com/search?q=new%20york%20dijon&btnI=Im+Feeling+Lucky, google.com/search?btnI=1&q=new%20york%20dijon, google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=new%20york%20dijon
    – 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












  • @JustJake, the lucky button contains a non-standard attribute: jsaction="sf.lck".
    – Synetech
    Jan 8 '14 at 1:13














12












12








12


4





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.



http://www.google.com/search?q=searchterm&btnI=745


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:



http://www.google.com/search?q=new%20york&btnI=745          <- works
http://www.google.com/search?q=new%20york%20dijon&btnI=745 <- 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















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.



http://www.google.com/search?q=searchterm&btnI=745


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:



http://www.google.com/search?q=new%20york&btnI=745          <- works
http://www.google.com/search?q=new%20york%20dijon&btnI=745 <- 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.







search search-engines google-search






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 8 '14 at 0:34

























asked Dec 31 '13 at 1:44









arboreal shark

10110




10110












  • These fail: google.com/search?q=new%20york%20dijon&btnI=Im+Feeling+Lucky, google.com/search?btnI=1&q=new%20york%20dijon, google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=new%20york%20dijon
    – 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












  • @JustJake, the lucky button contains a non-standard attribute: jsaction="sf.lck".
    – Synetech
    Jan 8 '14 at 1:13


















  • These fail: google.com/search?q=new%20york%20dijon&btnI=Im+Feeling+Lucky, google.com/search?btnI=1&q=new%20york%20dijon, google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=new%20york%20dijon
    – 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












  • @JustJake, the lucky button contains a non-standard attribute: jsaction="sf.lck".
    – Synetech
    Jan 8 '14 at 1:13
















These fail: google.com/search?q=new%20york%20dijon&btnI=Im+Feeling+Lucky, google.com/search?btnI=1&q=new%20york%20dijon, google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=new%20york%20dijon
– Ivan Chau
Dec 31 '13 at 3:59






These fail: google.com/search?q=new%20york%20dijon&btnI=Im+Feeling+Lucky, google.com/search?btnI=1&q=new%20york%20dijon, google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=new%20york%20dijon
– 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 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




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






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














@JustJake, the lucky button contains a non-standard attribute: jsaction="sf.lck".
– Synetech
Jan 8 '14 at 1:13




@JustJake, the lucky button contains a non-standard attribute: jsaction="sf.lck".
– Synetech
Jan 8 '14 at 1:13










4 Answers
4






active

oldest

votes


















2














Made a workaround Greasemonkey script:



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

document.getElementById("gsr").style.display = 'none'; // optional. shows blank screen before forwarding. just looks better imo.
document.getElementById("gbqfq").focus();
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];
btnLucky.click();


This script will always forward you to Google's "I Feel Lucky" choice provided you navigate to www.google.com/?lucky=searchterm_goes_here.



I'm using it in FireFox by having a keyword to a bookmark going to www.google.com/?lucky=%s.






share|improve this answer































    1














    When you have Javascript disabled, it seems that Google uses both a cookie and the HTTP Referrer header being set to https://www.google.com 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





























      1














      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://*.google.co.uk/search?q=*&btnI
      // @match https://*.google.co.uk/search?q=*&btnI
      // @match http://*.google.com/search?q=*&btnI
      // @match https://*.google.com/search?q=*&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





















      • This works for simple queries but not more complex ones unfortunately. A script that uses javascript to click the top result would be better.
        – Kevin
        Dec 3 at 6:15



















      0














      Some of the otherwise-elegant solutions on this page no longer work, so I'm adding my solution here, which is working for me on tampermonkey chrome in Dec of 2018.



      @match vs. @include has changed for tampermonkey (@match can't include query terms) which caused quite a bit of debugging frustration with this in case google changes their URLs.



      // ==UserScript==
      // @name I'm feeling lucky fix
      // @version 0.1
      // @description Makes Google I'm feeling lucky work reliably from the address bar
      // @author Kevin Watt
      // @include https://www.google.*/*btnI*
      // ==/UserScript==
      // // @match https://*/*
      if (location.href.indexOf('btnI')) document.querySelector('#search a').click()





      share|improve this answer





















        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "3"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f695110%2fconsistent-im-feeling-lucky-macro-for-google%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        2














        Made a workaround Greasemonkey script:



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

        document.getElementById("gsr").style.display = 'none'; // optional. shows blank screen before forwarding. just looks better imo.
        document.getElementById("gbqfq").focus();
        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];
        btnLucky.click();


        This script will always forward you to Google's "I Feel Lucky" choice provided you navigate to www.google.com/?lucky=searchterm_goes_here.



        I'm using it in FireFox by having a keyword to a bookmark going to www.google.com/?lucky=%s.






        share|improve this answer




























          2














          Made a workaround Greasemonkey script:



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

          document.getElementById("gsr").style.display = 'none'; // optional. shows blank screen before forwarding. just looks better imo.
          document.getElementById("gbqfq").focus();
          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];
          btnLucky.click();


          This script will always forward you to Google's "I Feel Lucky" choice provided you navigate to www.google.com/?lucky=searchterm_goes_here.



          I'm using it in FireFox by having a keyword to a bookmark going to www.google.com/?lucky=%s.






          share|improve this answer


























            2












            2








            2






            Made a workaround Greasemonkey script:



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

            document.getElementById("gsr").style.display = 'none'; // optional. shows blank screen before forwarding. just looks better imo.
            document.getElementById("gbqfq").focus();
            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];
            btnLucky.click();


            This script will always forward you to Google's "I Feel Lucky" choice provided you navigate to www.google.com/?lucky=searchterm_goes_here.



            I'm using it in FireFox by having a keyword to a bookmark going to www.google.com/?lucky=%s.






            share|improve this answer














            Made a workaround Greasemonkey script:



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

            document.getElementById("gsr").style.display = 'none'; // optional. shows blank screen before forwarding. just looks better imo.
            document.getElementById("gbqfq").focus();
            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];
            btnLucky.click();


            This script will always forward you to Google's "I Feel Lucky" choice provided you navigate to www.google.com/?lucky=searchterm_goes_here.



            I'm using it in FireFox by having a keyword to a bookmark going to www.google.com/?lucky=%s.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 14 '14 at 17:51

























            answered Jan 8 '14 at 11:36









            arboreal shark

            10110




            10110

























                1














                When you have Javascript disabled, it seems that Google uses both a cookie and the HTTP Referrer header being set to https://www.google.com 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


























                  1














                  When you have Javascript disabled, it seems that Google uses both a cookie and the HTTP Referrer header being set to https://www.google.com 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
























                    1












                    1








                    1






                    When you have Javascript disabled, it seems that Google uses both a cookie and the HTTP Referrer header being set to https://www.google.com 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












                    When you have Javascript disabled, it seems that Google uses both a cookie and the HTTP Referrer header being set to https://www.google.com 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












                    share|improve this answer



                    share|improve this answer










                    answered Jan 7 '14 at 11:29









                    Just Jake

                    633417




                    633417























                        1














                        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://*.google.co.uk/search?q=*&btnI
                        // @match https://*.google.co.uk/search?q=*&btnI
                        // @match http://*.google.com/search?q=*&btnI
                        // @match https://*.google.com/search?q=*&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





















                        • This works for simple queries but not more complex ones unfortunately. A script that uses javascript to click the top result would be better.
                          – Kevin
                          Dec 3 at 6:15
















                        1














                        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://*.google.co.uk/search?q=*&btnI
                        // @match https://*.google.co.uk/search?q=*&btnI
                        // @match http://*.google.com/search?q=*&btnI
                        // @match https://*.google.com/search?q=*&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





















                        • This works for simple queries but not more complex ones unfortunately. A script that uses javascript to click the top result would be better.
                          – Kevin
                          Dec 3 at 6:15














                        1












                        1








                        1






                        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://*.google.co.uk/search?q=*&btnI
                        // @match https://*.google.co.uk/search?q=*&btnI
                        // @match http://*.google.com/search?q=*&btnI
                        // @match https://*.google.com/search?q=*&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












                        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://*.google.co.uk/search?q=*&btnI
                        // @match https://*.google.co.uk/search?q=*&btnI
                        // @match http://*.google.com/search?q=*&btnI
                        // @match https://*.google.com/search?q=*&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












                        share|improve this answer



                        share|improve this answer










                        answered Apr 28 '16 at 18:41









                        Will Rice

                        111




                        111












                        • This works for simple queries but not more complex ones unfortunately. A script that uses javascript to click the top result would be better.
                          – Kevin
                          Dec 3 at 6:15


















                        • This works for simple queries but not more complex ones unfortunately. A script that uses javascript to click the top result would be better.
                          – Kevin
                          Dec 3 at 6:15
















                        This works for simple queries but not more complex ones unfortunately. A script that uses javascript to click the top result would be better.
                        – Kevin
                        Dec 3 at 6:15




                        This works for simple queries but not more complex ones unfortunately. A script that uses javascript to click the top result would be better.
                        – Kevin
                        Dec 3 at 6:15











                        0














                        Some of the otherwise-elegant solutions on this page no longer work, so I'm adding my solution here, which is working for me on tampermonkey chrome in Dec of 2018.



                        @match vs. @include has changed for tampermonkey (@match can't include query terms) which caused quite a bit of debugging frustration with this in case google changes their URLs.



                        // ==UserScript==
                        // @name I'm feeling lucky fix
                        // @version 0.1
                        // @description Makes Google I'm feeling lucky work reliably from the address bar
                        // @author Kevin Watt
                        // @include https://www.google.*/*btnI*
                        // ==/UserScript==
                        // // @match https://*/*
                        if (location.href.indexOf('btnI')) document.querySelector('#search a').click()





                        share|improve this answer


























                          0














                          Some of the otherwise-elegant solutions on this page no longer work, so I'm adding my solution here, which is working for me on tampermonkey chrome in Dec of 2018.



                          @match vs. @include has changed for tampermonkey (@match can't include query terms) which caused quite a bit of debugging frustration with this in case google changes their URLs.



                          // ==UserScript==
                          // @name I'm feeling lucky fix
                          // @version 0.1
                          // @description Makes Google I'm feeling lucky work reliably from the address bar
                          // @author Kevin Watt
                          // @include https://www.google.*/*btnI*
                          // ==/UserScript==
                          // // @match https://*/*
                          if (location.href.indexOf('btnI')) document.querySelector('#search a').click()





                          share|improve this answer
























                            0












                            0








                            0






                            Some of the otherwise-elegant solutions on this page no longer work, so I'm adding my solution here, which is working for me on tampermonkey chrome in Dec of 2018.



                            @match vs. @include has changed for tampermonkey (@match can't include query terms) which caused quite a bit of debugging frustration with this in case google changes their URLs.



                            // ==UserScript==
                            // @name I'm feeling lucky fix
                            // @version 0.1
                            // @description Makes Google I'm feeling lucky work reliably from the address bar
                            // @author Kevin Watt
                            // @include https://www.google.*/*btnI*
                            // ==/UserScript==
                            // // @match https://*/*
                            if (location.href.indexOf('btnI')) document.querySelector('#search a').click()





                            share|improve this answer












                            Some of the otherwise-elegant solutions on this page no longer work, so I'm adding my solution here, which is working for me on tampermonkey chrome in Dec of 2018.



                            @match vs. @include has changed for tampermonkey (@match can't include query terms) which caused quite a bit of debugging frustration with this in case google changes their URLs.



                            // ==UserScript==
                            // @name I'm feeling lucky fix
                            // @version 0.1
                            // @description Makes Google I'm feeling lucky work reliably from the address bar
                            // @author Kevin Watt
                            // @include https://www.google.*/*btnI*
                            // ==/UserScript==
                            // // @match https://*/*
                            if (location.href.indexOf('btnI')) document.querySelector('#search a').click()






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Dec 3 at 7:02









                            Kevin

                            1011




                            1011






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Super User!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f695110%2fconsistent-im-feeling-lucky-macro-for-google%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Plaza Victoria

                                In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                                How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...