Answer the question
In order to leave comments, you need to log in
How to disable the opening of the second tab?
That is, you need to reliably prohibit the user from opening the second tab of a page that is already open in his browser. Ideally, when opening a second tab, he should see a notification about the ban and close it after pressing the OK button.
Answer the question
In order to leave comments, you need to log in
The most reliable option is to allow you to open a second tab, while disabling all previous ones. For example, for each tab, generate a unique id (when requesting a page display) and allow the server to work only with the last window. This is how whatsapp web works.
This can work if you can identify the user and your page is actively communicating with the server via AJAX.
When opened, the user is assigned a token, which is verified by the server on each request.
When opening the second tab, a different token will be generated, so requests from the first one will be hit.
Otherwise, you will not be able to determine whether the user closed the previous page before opening a new one on the server.
Probably we are talking about some kind of server application with crutches, in which you need to provide exclusive access to data so that when you open different windows, the data is not overwritten.
You will not be able to get 100% exclusive access. after receiving data from the server, the connection is closed. Even if you somehow screw in tokens, AJAX and other things, it will be a problem to know whether the user has closed the first window or not, and you will get a complete blocking of data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question