在javascript中使用window.open()是否有任何限制

时间:2021-08-16 07:39:36

Is there any limit of using window.open("URL"); in JavaScript?
when I tried to open three windows using window.open("URL") after opening the second window the third window didn't open separately but it just refreshed the contents of first window and showed the contents of the third window in there.

使用window.open(“URL”)是否有限制;在JavaScript?当我在打开第二个窗口后尝试使用window.open(“URL”)打开三个窗口时,第三个窗口没有单独打开,但它只刷新了第一个窗口的内容并显示了第三个窗口的内容。

2 个解决方案

#1


0  

Try this-

尝试这个-

window.open(url, targetName);

If the targetName is different,the windows will open separately.You can set the targetName randomly to open windows separately.
For Example,

如果targetName不同,则窗口将单独打开。您可以随机设置targetName以单独打开窗口。例如,

window.open(url,Math.floor(Math.random() * 80000));

#2


2  

Using "_blank" as the target window should open a new window every time (just like with <a href="url" target="_blank">link</a>). For example:

使用“_blank”作为目标窗口应该每次都打开一个新窗口(就像使用链接一样)。例如:

window.open("URL", "_blank");

But opening multiple windows can be subject to various pop-up blocking features and plugins.

但是打开多个窗口可能会受到各种弹出窗口阻止功能和插件的影响。

#1


0  

Try this-

尝试这个-

window.open(url, targetName);

If the targetName is different,the windows will open separately.You can set the targetName randomly to open windows separately.
For Example,

如果targetName不同,则窗口将单独打开。您可以随机设置targetName以单独打开窗口。例如,

window.open(url,Math.floor(Math.random() * 80000));

#2


2  

Using "_blank" as the target window should open a new window every time (just like with <a href="url" target="_blank">link</a>). For example:

使用“_blank”作为目标窗口应该每次都打开一个新窗口(就像使用链接一样)。例如:

window.open("URL", "_blank");

But opening multiple windows can be subject to various pop-up blocking features and plugins.

但是打开多个窗口可能会受到各种弹出窗口阻止功能和插件的影响。