Possible to detect if a user has multiple tabs of your site open? Possible to detect if a user has multiple tabs of your site open? javascript javascript

Possible to detect if a user has multiple tabs of your site open?


I'm fairly late to the party here (over a year), but I couldn't help but notice that you'd missed an incredibly easy and elegant solution (and probably what that website you saw used).

Using JavaScript you can change the name of the window you currently have open through:

window.name = "myWindow";

Then when you send out your confirmation email simply do (assuming you're sending a HTML email):

<a href="verificationlink.php" target="myWindow">Verify</a>

Which should result in the verificationLink opening up inside the window your website was already loaded into, if it's already been closed it'll open up a new tab with the window name specified.


You can stop the page functionality when user opened another tab or another window or even another browser

$(window).blur(function(){    // code to stop functioning or close the page  });


You can send an AJAX request every X seconds from the original tab that asks the server if it received a request from the email.

You cannot close the second tab automatically, but you could have it ask the server after 3X seconds whether it heard from the first tab.