Skip to content Skip to sidebar Skip to footer

Detect If A Web Site Is Already Open And Reuse Window

I'm trying to find out if there is a way to open a url link in an email and reuse a window if a certain page ( or site ) is already open. What I have is a 'forgot password' page wh

Solution 1:

This is completely up to the browser to decide; some browsers might be able to guess what you're trying to do and replace an existing tab with the new page, but on the whole that doesn't make sense.

This is what you could do (though it's not really technical):

  1. after the email is entered and submitted, the form page changes and asks them for the security code that's being sent to them.

  2. inside the email you print the security code in a clear manner for the user to double-click and copy to their clipboard; they would then switch to their browser again (with your page still open) and paste the value. You can still provide the link for ease of the user, of course.

Btw, to make an easily selectable code for the user to copy into their clipboard I found that using base32 encoding is the best; those codes can be selected easily, even with iOS devices.

Solution 2:

You could have the page opened by the email send out a postMessage request and have the other page answer that is is still open. If that happened, the new tab could close immediately.

However, switching between tabs/windows is something happens at the OS or browser level, not the page level, and there is no way to switch to the open tab using JavaScript. You could write a browser extension to do it, but that's probably innapropriate for something so trivial, and no one would bother to install it.

Post a Comment for "Detect If A Web Site Is Already Open And Reuse Window"