Reputation: 3518
I like to prevent the user from opening my webpage in more then one window/tab.
I tried naming the window with window.name
but you end up with two windows with the same name.
PS: I use pure/vanilla Javascript
Upvotes: 1
Views: 1554
Reputation: 610
One option here is to track what pages you (your script) specifically opened and store that in local storage. Since local storage is shared between tabs/windows, you could keep track of open windows. The limitation to this is if that window was opened by other means, it could be a bit problematic.
Upvotes: 1