Open multiple links in Chrome at once as new tabs

前端 未结 7 1563
小蘑菇
小蘑菇 2020-11-29 09:32

I\'m trying to open multiple links at once in Google Chrome in new tabs but it fails.

Problems:

  1. Blocked by popup
  2. Open in new windows instead o
7条回答
  •  天命终不由人
    2020-11-29 09:52

    Looks like extension uses below code to open those tabs.

    function openTab(urls, delay, window_id, tab_position, close_time) {
        var obj = {
                windowId: window_id,
                url: urls.shift().url,
                selected: false
        }
    
        if(tab_position != null) {
            obj.index = tab_position
            tab_position++;
        }
    
        chrome.tabs.create(obj, function(tab) {
            if(close_time > 0) {
                window.setTimeout(function() {
                    chrome.tabs.remove(tab.id);
                }, close_time*1000);
            }
        });
    
        if(urls.length > 0) {
            window.setTimeout(function() {openTab(urls, delay, window_id, tab_position, close_time)}, delay*1000);
        }
    
    }
    

    If you want to take a look at the code of the extension for reference you will find the extensions in (for Windows) C:\Documents and Settings\*UserName*\Local Settings\Application Data\Google\Chrome\User Data\Default\Extensions

提交回复
热议问题