Open multiple tabs in the same browser by JavaScript

前端 未结 2 1698
礼貌的吻别
礼貌的吻别 2021-01-20 03:10

I would like to open multiple tab in the main browser: Here is my code:

    function openSM()
    {
        window.open(\"http://www.google.com\",\"_blank\")         


        
2条回答
  •  清歌不尽
    2021-01-20 04:06

    I had done similar work, but didn't get success using simple javascript on page. So I create an extension and then the same code worked, you need a little modification in that:

        var urls = ["http://www.google.com", "http://www.yahoo.com", "http://www.bing.com"];
    
        var interval = setInterval(function() {
            var url = urls.pop();
            if(!!url) {
                window.open(url);
            }
            else {
                clearInterval(interval);
            }
        }, 100);
    

    Hope this work for you too.

提交回复
热议问题