cancel
Showing results for 
Search instead for 
Did you mean: 

Prevent users from using multiple tabs

Prevent users from using multiple tabs

Hi,

    I am a magento 2 enterpise edition developer. How can we prevent the users of a store from having the store window open in his/her browser's multiple tab?.  We must make sure that the user cant use the website on 2 different windows of the same browser. We do not have user registrations, all our customers do purchase anonymously.

Is there any magento api available to do it? If there is not, please suggest a best way to do this....

1 REPLY

Re: Prevent users from using multiple tabs

Hi Gautamkrishnar,

 

Why would you want to do this? Is there something you re trying to stop?

 

Restricting the use of multiple tabs is quite a difficult task and I am not sure there is a gold solution. The tabs are created in the browser application and webservers have no concept of what they are. It will just keep accepting new sessions. 

 

You could always use javascript to stop users right clicking and using "open in new tab". This would reduce 99% of accidental new tabs but could obviously this could be bypassed if they really want multiple tabs. It obviously won't stop them manually opening tabs and arriving at pages via google or by copy and pasting the url.

 

The only other way I can think to achieve this is by using a cookie to set a session ID. This cookie could then be used to to append to the end of the URL and then it doesn't matter how many tabs are open as the session could be used to identify the user. Not 100% sure how you would implement this though and it could also be circumvented by using private browsing or similar.