Reputation: 526
With my web application, I need to keep only a singe instance of the page at once. If new instance is opened in a new tab, I need to close the previous one. I have seen many posts related to this and all of them are saying that I can only close tabs in Chrome that are opened programmatically and by created by itself but not the current tab. I am aware of it being a security threat but this is the customer's requirement. Client browser settings are controlable and I can do any settings as needed. So, I am looking a way to go around this security policy.
Upvotes: 0
Views: 681
Reputation: 1365
You only can close the page you open. but you can close another tab.
But you can still achieve what you want. Communicate to your server and check if the same client open two tabs by checking their token stored in their page. If yes, close one of them (you can only close itself), if you are failed to close itself because of some security reason, then just turn the whole page white.
Upvotes: 1