开发者

Detect opened windows/tabs in Firefox

开发者 https://www.devze.com 2023-01-17 12:50 出处:网络
I have an application window that displays a button. On button click, a new tab is opened with window.open javascript function and later I would like to be able to detect if that link is opened or not

I have an application window that displays a button. On button click, a new tab is opened with window.open javascript function and later I would like to be able to detect if that link is opened or not and if it is, I need to close that window. Can this be done in Firefox开发者_StackOverflow社区 ?

Thanks.


The window.open() function returns a Window object. Just call close() on it:

var childWindow = window.open(....);

...

childWindow.close();
0

精彩评论

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

关注公众号