-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure correct tab can be identified following discard #4
Comments
As long as the two tabs were not "scriptable" from each other (i.e. one did not launch the other, or they weren't both launched from the same tab) then sessionStorage should be unique between them. As long as we don't discard sessionStorage when a page is discarded, that would work. As long as we distinguish (in both spec and implementation) page discard vs. session ending, it should be okay. In the case where the tabs are part of the same session, they'd need to somehow mint unique IDs and key storage off of that, and stash the ID via the page history API or something. |
Potentially relevant: over on w3c/ServiceWorker#1254 @jakearchibald wrote:
I haven't been part of that discussion, but part of the clients API is a unique identifier per page. (I'm leaning on that over in https://github.com/inexorabletash/web-locks too). Spec-wise, this is defined as the environment's id which is not (?) yet (?) exposed to script directly. If it was, a page could use that as part of a key for page-specific state storage. |
@fmeawad - see link to exposing Client API |
I like the idea of exposing Client ID. |
Asking apps to use History API to workaround this seems bit unpalatable. |
Let's say there are two tabs (tab1 and tab2) from an origin with identical URL, say foo.com.
They are both in the background and are both discarded.
Now the user revisits tab2 -- Document will surface "wasDiscarded" to allow restoring state that might have been saved in prior onfreeze or pagevisibility event.
However the app should be able to know that it needs to restore state for tab2 as opposed to tab1.
Could the app use sessionStorage to reliably record session instance?
@inexorabletash
@toddreifsteck
The text was updated successfully, but these errors were encountered: