javascript - Close all child tabs when parent tab is closed - Stack Overflow

There is a page in asp which have a link that opens into a new tab in browser. So when I close my paren

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
Add a ment  | 

1 Answer 1

Reset to default 6

Whenever 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();

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744892620a4599506.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信