News for hackers. Stuff that matters.
Re:URLs are state containers by layer8 on Sunday November 02, 2025 @10:13AM (#45790881)
> 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.

Re:URLs are state containers by mejutoco on Sunday November 02, 2025 @11:31AM (#45791467)
You could work around that if needed with a unique id per tab (I was curious myself)

https://stackoverflow.com/questions/11896160/any-way-to-iden...

Re:URLs are state containers by layer8 on Sunday November 02, 2025 @11:41AM (#45791544)
Yes, 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.
Re:URLs are state containers by MattDaEskimo on Sunday November 02, 2025 @04:14PM (#45793510)
Scroll position is _kind of_ fine. Typically I can link the ID in the URL as "state".

I was referring to mostly everything else

Re:URLs are state containers by phillipseamore on Sunday November 02, 2025 @01:19PM (#45792257)
sessionStorage should treat the windows/tabs as separate