Passing browser tab information to backend?

Scenario:

We have one analysis that gives different results based on different inputs. So if a user opens the same analysis in two different browser tabs, the shared session variables will be overridden and the output will be the same on both tabs, although we want the different outputs to be based on different user inputs in the tabs.

So, we are planning to send tab-id

to the backend to keep the session variables behind tab-id

.

Is there some kind of automatic way to send the tab information to the server, like in the request header or something like that? Or will we need to generate it tab-id

ourselves and send it with every request?

+3


source to share


1 answer


You will need to generate your tab ID and pass it with every request, but the following might make it a little easier:

You can use sessionStorage from the Web Storage API to store values โ€‹โ€‹that are unique to each tab. Each tab in the browser starts a new session, so they are always different.

https://developer.mozilla.org/en/docs/Web/API/Window/sessionStorage



It should work with most common browsers (even IE8 +): http://caniuse.com/#search=web%20storage

Hope it helps!

+1


source







All Articles