Preventing a site to reopen in a new tab

Hello

I have been looking around for a solution to my problem and thought I might get some help / ideas here.

If my website is opened in a browser, the same website should not open in a new tab of the same browser. Is this possible anyway?

Thanks

It’s… theoretically doable, but would require some sneaky link coding. Why do you need to do this, though? There’s likely a better solution.

Its a requirement from the client.

I don’t think that will be easily doable without a lot of hackery. Chrome, for example, hosts each tab in its own process, and I don’t think it will be easy to communicate between tabs/ windows in such a situation.

Save yourself a lot of hassle and tell your client that that isn’t the way browsers work.

Having said all that:

  1. when the site is opened, use JS to set a random name for the window (window.name = “random string”)
  2. save this in a PHP session
  3. any requests coming from different window names within the same session? show them a ‘not allowed’ message

Evil.

i would’ve just said “sorry, that’s not possible”

what was the client’s reason for this requirement?

maybe you’re “fixing the wrong problem”

here’s one of google’s results for that phrase – http://www.positive-way.com/business/root1.htm

I agree with Rudy. Any solution you can implement to attempt to stop the same person opening multiple copies of the page can be easily bypassed (unless it is a member’s only area where they have to log in first and where logging in on a second tab would invalidate the session on the first tab).

So find out why the client has that requirement and resolve the cause of their request instead.