Opening multiple sites on the browser tabs with window.open

后端 未结 2 603
深忆病人
深忆病人 2021-01-27 22:07

I have the following code and need to open two new tabs pointing to 2 web sites. For example: www.google.com and www.yahoo.com

It works only if I put one site in there

相关标签:
2条回答
  • 2021-01-27 22:43

    In the bad old days, it was common for malicious websites to fork bomb browsers by triggering an infinite loop of new windows.

    They implemented protection against this by allowing new windows (and tabs) to be opened only when the function was triggered by a user event (e.g. a click but not a page load) and restricting this to opening a single window.

    Some browsers may prompt the user to allow an additional window to open, but there is no way for a website to simply bypass this important security feature.

    0 讨论(0)
  • 2021-01-27 22:56

    I run your code. Both sites opened. But before it opens browser blocked popup window so i had to allow it to open. Try your code. And dont forget to allow popup after pressing button.

    0 讨论(0)
提交回复
热议问题