Reputation: 4733
There is a page in asp.net 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.
Upvotes: 2
Views: 5170
Reputation: 38820
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();
Upvotes: 6