Reputation: 21
Hi I am trying to close all other or child tabs in the browser window while keeping the first tab open. I want to do this with a JavaScript function call....Can anyone help?
All I can get is a function for closing the window.
Upvotes: 1
Views: 714
Reputation: 359966
As far as I know, there's nothing built-in to do this.
You get a handle to the other windows you have opened (when you call window.open()
). Keep all the handles from all the window.open
calls in an array. Then, when you want to close all the child windows, iterate through the array and call Window.close()
on each element.
Upvotes: 2