8 ms·
I can understand "shareable" state (scroll position), but _as much as possible_ seems like overkill. Why not just use localStorage?
by MattDaEskimo 11mo ago
I can understand "shareable" state (scroll position), but _as much as possible_ seems like overkill.
Why not just use localStorage?
- layer8 11mo ago> Why not just use localStorage? So that I can operate two windows/tabs of the same site in parallel without them stealing each other’s scroll position. In addition, the second window/tab may have originated from duplicating the first one.
- mejutoco 11mo agoYou could work around that if needed with a unique id per tab (I was curious myself) https://stackoverflow.com/questions/11896160/any-way-to-identify-browser-tab-in-javascript https://stackoverflow.com/questions/11896160/any-way-to-iden...
- layer8 11mo agoYes, but how do you garbage-collect the stored per-tab state from the local storage? Note that it’s not just per tab, but per history entry of the tab. (When the user goes back, they want the respective state to be restored, and again when going forward in reverse.) Furthermore, with browser features like “reopen closed tab”. Better let the browser manage the state implicitly by managing the URLs.
- MattDaEskimo 11mo agoScroll position is _kind of_ fine. Typically I can link the ID in the URL as "state". I was referring to mostly everything else
- phillipseamore 11mo agosessionStorage should treat the windows/tabs as separate