Open multiple links in Chrome at once as new tabs Open multiple links in Chrome at once as new tabs google-chrome google-chrome

Open multiple links in Chrome at once as new tabs


You can do this in vanilla JavaScript:

<html><head><script type="text/javascript">function open_win() {    window.open("http://www.java2s.com/")    window.open("http://www.java2s.com/")}</script></head><body><form><input type=button value="Open Windows" onclick="open_win()"></form></body></html>

Here is a more Chrome-specific implementation (if popup blockers are giving you difficulty):

var linkArray = []; // your linksfor (var i = 0; i < linkArray.length; i++) {    // will open each link in the current window    chrome.tabs.create({        url: linkArray[i]    });}

Here is some documentation: https://developer.chrome.com/extensions/tabs


The reason that the browser extension can do it is because Chrome extensions have access to a special Chrome API, which lets you use:

chrome.windows.create({tabid: n})

where createData has a tabid value greater than any current tab (and you can find the greatest current tabid using chrome.windows.getAll()).

However, in terms of doing it on your page (or anywhere that's not a Chrome extension), that's not possible, since whether or not a new window opens in a new tab is determined entirely by the user's settings.


The best way to open multiple tabs or windows is by using setTimeout() of 500ms.

window.open("https://facebook.com", "one", windowFeatures);setTimeout(function(){  window.open("https://facebook.com", "two", windowFeatures);}, 500);