admin管理员组文章数量:1410737
There is a page in asp which have a link that opens into a new tab in browser. So when I close my parent tab all the child tabs should be closed.
How can I do that?
My approach was using Javascript but till now not reached too far.
There is a page in asp which have a link that opens into a new tab in browser. So when I close my parent tab all the child tabs should be closed.
How can I do that?
My approach was using Javascript but till now not reached too far.
Share Improve this question edited Jul 30, 2021 at 8:22 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Jul 28, 2011 at 11:56 ankurankur 4,74315 gold badges67 silver badges104 bronze badges 1- @ -1 marker can u provide the reason for your curtsy – ankur Commented Jul 28, 2011 at 12:20
1 Answer
Reset to default 6Whenever you call window.open(), you are given a handle:
myWindow = window.open(/* open stuff*/);
If you keep track of these handles in an array (for example), you can then call:
myWindow.close();
When you're done.
Edit
For example:
var wnds = new Array();
Whenever you want to open a window:
wnds[wnds.length] = window.open(/* open stuff*/);
And to close them all
for(i = 0; i < wnds.length; ++i)
wnds[i].close();
本文标签: javascriptClose all child tabs when parent tab is closedStack Overflow
版权声明:本文标题:javascript - Close all child tabs when parent tab is closed - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744892620a2630874.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论