Ways to detect CTRL-N or when a user opens a new window

后端 未结 6 1432
醉酒成梦
醉酒成梦 2020-12-22 12:52

How can we detect when a user opens a new window. The user is already authenticated and we make heavy use of sessions.

We were trying to avoid Ctrl+

6条回答
  •  一生所求
    2020-12-22 13:44

    What I have done to solve this issue is when the user authenticates set the window name on valid login.

    
    

    And then on the master page do a javascript check:

    
    

    If the check is true then hide/remove the main content of the page and show a message stating they are doing something unsupported.

    This works when your login page is not tied into the master page.

    If you do not have a master page then I would suggest putting the check on all your pages.

提交回复
热议问题