Calling Window.open() Multiple Times Fails After The First Time
I have a script that loops through multiple urls and opens them in a new tab. It used to work but now only opens the first one. There's even a w3schools test editor that supposedly
Solution 1:
I think as @Daniel Sharp said, there is a security feature in chrome. It works fine in FF and IE.
It works if I follow below steps:
- Click Open Windows (A new window will open)
- Click on inital browser tab
- Click somewhere on the page (Except Open Windows button)
- Click on Open Windows again (IT works this time - two windows are open)
Solution 2:
As noted in another answer and the comments, it is a security feature.
It is worth adding, however, that you can disable it (on a per-site basis): simply click the small "popup blocker" icon at the right end of the address bar and enable popups from the current site.
Afterwards, feel free to shoot as many window.open
's as you need.
Solution 3:
The window name should be unique. Otherwise, the same page will refresh
functionmyFunction() {
window.open("https://www.google.com/","_google","height=200,width=150");
window.open("https://www.w3schools.com/","_w3schools","height=200,width=150");
}
Post a Comment for "Calling Window.open() Multiple Times Fails After The First Time"