简体   繁体   中英

Can you check if a web application is already running on another browser tab?

I have a web application written in ASP.NEt/C# and javascript. It uses session variables.

When I open the application, is there a way to check if the application is running in another tab?

Or do you have any ideas on making session variables unique for each tab?

Any help would be great!

Thanks

Kev.

First understand sessions. The session is a file which lives on the server and holds some data. When the user gets a session they are really getting a cookie with some key to find which session is theirs.

Because of this, between different tabs in the same browser the cookie will be the same so it will access the same session on the server in both tabs. You can make them unique by when you start the session giving a random ID but this (to my knowledge) will simply overwrite the previous session's value...

You can use Session.IsNewSession() method to check For the Particular Session is a New one. Normally in web browsers with Multi Tabs the session is same through out that window

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM