Recently, I attempted to launch a new tab using the code snippet below:
window.open("wwww.stackoverflow.com", "_blank");
Although this method worked perfectly fine when opening a single URL, things took an unexpected turn when I tried to open multiple URLs stored in an array. Strangely, only the first element from the array opened in a new tab, despite all loops being executed.
for (let i = 0; i < urlArray.length; i++) {
console.log("opening tab" + i);
window.open(urlArray[i], "_blank");
}
Any insights on why this might be happening?
Your help is greatly appreciated :)