skip to Main Content

Could you please help me with a problem? When I search for something on Google, I usually open all the links (about 10 or more) and then go through them one by one. I would like to enable a feature where all the query results (about 10 on the search page) open immediately in the same window.

If someone can help, it would be greatly appreciated.

If a custom script for tabs in the browser can achieve this, it would be ideal. However, I welcome any other suggestions or solutions.

2

Answers


  1. Chosen as BEST ANSWER

    add this script to the browser with the Tampermonkey extension and create a new script below.

    // ==UserScript==
    // @name         Open Top Google Search Results
    // @namespace    http://tampermonkey.net/
    // @version      1.0
    // @description  Automatically open top Google search results in new tabs
    // @author       Your Name
    // @match        https://www.google.com/search?*
    // @grant        none
    // ==/UserScript==
    
    (function() {
        'use strict';
    
        const numResults = 10; // Number of top results to open
    
        function openLinks() {
            const resultLinks = document.querySelectorAll('a h3');
            let count = 0;
    
            for (let i = 0; i < resultLinks.length && count < numResults; i++) {
                const link = resultLinks[i].parentElement;
                const url = link.href;
    
                if (URL) {
                    window.open(url, '_blank');
                    count++;
                }
            }
        }
    
        window.onload = function() {
            setTimeout(openLinks, 3000); // Adjust delay if necessary
        };
    })();
    

    Make sure to turn on Developer mode in the Chrome extension setting.


  2. You can create a snippet that will do that. First lets do a javascript code for the job:

    Let’s assume all links have ping attribute that starts with /url. Actually, it’s a little more complicated than that but I think this might work (as of today):

    document.querySelectorAll('#search a h3').forEach(function(h3) {
      /* if visible */
      if (h3.offsetParent !== null) {
        var a = h3.closest("a");
        var href = a.href;
        console.log(href);
      }
    })

    And the result, after using https://mrcoles.com/bookmarklet/, can be found here https://jsfiddle.net/swhev0yk/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search