简体   繁体   中英

How to close browser all open tabs related to a specific domain while logout from any of those one tab using angular js

Suppose I logged in onto a web app like www.website.com and open multiple tabs of this domain in a single browser. It is possible on angular app that, if I logged out from any on those one tab, all others tab are related to this (www.website.com) domain will be closed automatically?

If possible what will be the best solution on angular or JavaScript?

Thanks in advance.

You can only close windows if you have parent object of that window like

var win = window.open('Some Url', '_blank');
win.close()

but there is no way to close tabs of a browser, instead of that you can logout the user from all tabs by putting a time interval which check for a local storage or a cookies for every 10 or 15 second, and you need to flush that local storage or a cookies on logout button.

You can only close windows that you open yourself/using code. Which means you cannot programmatically close a window that the user opens. If you are opening a window using window.open() you can close that window using javascript using window.close() . But if a user is opening some window you can not close that window.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM