Recently a friend of mine noticed that I often open the first few Google results in tabs without looking at them first. Now I'd like to directly open the best Google results from the address bar. I know that it's possible to add custom search engines to the bar in the settings. However, how can I make Chrome open multiple tabs at once when using such a custom search engine?

2 Answers 2


You could perhaps run a webserver in the background which takes the query and passes it to a google "i'm feeling lucky" link. Opening more than one tab would obviously require you visting the website in chrome and explicitly allowing popups. To open the top 3(not only the first) search result, you will probably have to get the source code of the page(probably possible with either wget or links) and extract the search results from it. To only look for search results and avoid opening, say the gmail link, you may wish to filter out everything until the second hit of your search criteria.

Code for this would look something like this:

wget http://google.com/?q=$query -O $query.html
l=grep -n $query | head -c 1
head -cv $l
echo $source | grep '<a href='
for i in $l1 $l2 $l3; do google-chrome-unstable $i ;done

Note that my code is probably broken and I have no idea how to get the script to run without using command line, but maybe you could do it using a web2py server with the python system.os command.

Hope it helps


I know this is not exactly what you are looking for, but I made a bookmark with this JavaScript code in it, that opens the first 5 results from a Google search result in new tabs, if you are on the search result page:

javascript: (function (element, url) {
    element.src = url;
    element.onload = function () {
        var elements = jQuery("#search .g:nth-child(-n+4)>div>div>a:first-child");
        jQuery.each(elements, function (key, element) {
            win = window.open(element.href, '_blank');
            if (key > 3) {
                return false;
            if (win) {
            } else {
                alert('Please allow popups for this website');
})(document.createElement('script'), '//code.jquery.com/jquery-latest.min.js')

The .g:nth-child(-n+4) is where you can set the number of tabs, in this case it's 5.

Unfortunately Google changes the DOM structure every once in a while, so you need to adjust the code. Most of the time it's only a minuscule changes, where you have to swap one selector for another.

You create this kind of bookmark by adding a new bookmark and past this code as the "URL". Voilà!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.