I want to open multiple tabs in chrome to let user download multiple documents (not .zip) The have done codin using underscore.js. I am using window.open() in _.each() method. but chrome does not open more than one tab.Please help.
Asked
Active
Viewed 254 times
-1
-
There are good answers to this question. Try Bagelzones [Chrome explanation](http://stackoverflow.com/questions/16749907/window-open-behaviour-in-chrome-tabs-windows) and maclema's answer on [using callbacks](http://stackoverflow.com/questions/11999837/force-window-open-to-create-new-tab-in-chrome) – Andrew Johnston Nov 20 '14 at 12:22
1 Answers
0
When I needed to open URLs in new tabs, I used @Amro's answer modified as appears here:
// From https://stackoverflow.com/a/11389138
function openNewBackgroundTab(url) {
var a = document.createElement("a");
a.href = url;
var evt = document.createEvent("MouseEvents");
//the tenth parameter of initMouseEvent sets ctrl key
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0,
true, false, false, false, 0, null);
a.dispatchEvent(evt);
}