开发者

How to use Javascript to restrict browsers to create singular child window

开发者 https://www.devze.com 2023-02-20 21:07 出处:网络
Is there any Ja开发者_如何转开发vaScript syntax to make sure, across prevalent browsers, merely single child window will be created when users click buttons or hyperlinks?

Is there any Ja开发者_如何转开发vaScript syntax to make sure, across prevalent browsers, merely single child window will be created when users click buttons or hyperlinks?

Thanks.


Just always use the same target whether it's a link or a window.open call.

<a href="foo.html" target="child">foo</a>

window.open("bar.html", "child");


In which context are you talking about. Checking whether a tab of a certain kind is already open is not possible because it imposes security risks.

However, if you are suggesting to only have one window opened as Invoked by:

window.open(strUrl, strWindowName, strWindowFeatures)

Then you will only be able to have one window open at any time with a specified strWindowName.

0

精彩评论

暂无评论...
验证码 换一张
取 消