Live data from Hacker News

Don't rely on LocalStorage

blog.jacobweisz.com

31–40 of 71 posts

Re: Don't rely on LocalStorage

#31

> Ultimately, people should have control of their data, and they should have access to their data from all of their devices. Whether that is running their own or renting someone else's, that ultimately means the correct place to store web app data is on a server. Hrm. But I don't have control of my data on a server. The person running the server does. There is currently no good way to satisfy both of these conditions…

I specifically refer to self-hosting here, which does satisfy both of those conditions. (There is arguably still a lot of stress to making self-hosting a better experience for non-technical users, and unfortunately large tech companies are very motivated to maintain a paradigm opposed to self-hosting.)

But I also do not feel LocalStorage is really a good way to ensure you have control of your data: It's very unlikely you (or most anyone else) are auditing the code of a site to ensure it maintains your data locally, much less ensure that doesn't change over time.

Re: Don't rely on LocalStorage

#32

> LocalStorage is popular for web apps because it is lazy No... localStorage is popular because it allows you to persist state without requiring a server, opening up a whole lot of use cases that would normally require a login. With the tradeoff that you can't easily sync between machines and it can be cleared readily. Calling it "lazy" seems bit unnecessarily confrontational. Of all the times I have used localStorag…

> some other way to tell the server that Device A and Device B are the same person

Browsers already have both user identity across multiple devices and ability to sync data. It just needs to be extended to cookies and localstorage.

Re: Don't rely on LocalStorage

#34

> LocalStorage is popular for web apps because it is lazy No... localStorage is popular because it allows you to persist state without requiring a server, opening up a whole lot of use cases that would normally require a login. With the tradeoff that you can't easily sync between machines and it can be cleared readily. Calling it "lazy" seems bit unnecessarily confrontational. Of all the times I have used localStorag…

The excellent cross-browser support of localStorage and the simplicity of the API should also be appreciated

Re: Don't rely on LocalStorage

#35
I think there's some opportunity, if this doesn't already exist, to make some decentralized (WebRTC, with centralized fallback) way of synchronizing localStorage across multiple devices with a pre-shared key. A drop-in script would add functionality to show and scan a QR code or enter a 12 word phrase. It could even be a userscript running without the web app developer's involvement at all. A lot of hoopla for a word game, but could be quite handy in more scenarios.

Re: Don't rely on LocalStorage

#36
post #4

The author makes some decent points about localStorage generally, but I think really misses the point on what makes Wordle so successful and endearing. It was built as a side project for a very small audience and just happened to have massive, organic growth. If Josh Wardle had thought about all of these described use cases in advance, there's a much higher chance that it never would have gotten off the ground as a s…

So that's where the name came from. Makes you wonder how much such a simple thing as a last name impacted their life.

Re: Don't rely on LocalStorage

#37

> LocalStorage is popular for web apps because it is lazy No... localStorage is popular because it allows you to persist state without requiring a server, opening up a whole lot of use cases that would normally require a login. With the tradeoff that you can't easily sync between machines and it can be cleared readily. Calling it "lazy" seems bit unnecessarily confrontational. Of all the times I have used localStorag…

LocalStorage serves important use-cases - you mentioned a few - but I‘be seen it used a bunch in web apps, where the user is already logged in, to persist setting. It was easier than adding an API to store a user‘s UI settings/state.

Re: Don't rely on LocalStorage

#38

I bet even now, long after the NYT’s check has cleared, Josh is filled with a deep sense of regret over his decision to use LocalStorage. It keeps him up, long into the night. What could have been…

He knows, deep down, that he is a fraud. He used a mechanism built into the browser instead of building some big-brain distributed system with Kubernetes and stuff. Just like a fraud would do.

Re: Don't rely on LocalStorage

#39

> LocalStorage is popular for web apps because it is lazy No... localStorage is popular because it allows you to persist state without requiring a server, opening up a whole lot of use cases that would normally require a login. With the tradeoff that you can't easily sync between machines and it can be cleared readily. Calling it "lazy" seems bit unnecessarily confrontational. Of all the times I have used localStorag…

> But I for one think an app that doesn't constantly send my every move to the server is actually a breath of fresh air.

I strongly agree. For me as a user, use of localStorage (and its ability to run 100% offline and even be loaded from a local path) makes Wordle particularly charming and usable.

It's also the ultimate in zero-trust architecture because there is no back end.

Re: Don't rely on LocalStorage

#40
post #12
post #3

Regarding Wordle specifically, this allowed Josh Wardle to make the app a simple webpage with no backend necessary beyond serving the page itself. Is there something that allows someone like him to do that aside from LocalStorage?

I believe he could have used Cookies instead of LocalStorage. The data he's keeping seems simple enough. It has the same issues the author is talking about, but it should work.

Sure, but the same caveats generally apply; cookies are limited to a single browser on a single device.
Post reply on HN