Please Stop Relying on LocalStorage

So the latest craze in web games is currently Wordle. It's unsurprisingly pretty fun, and the stats and social sharing aspect make it instantly worth discussing with friends. However, only about two days into playing Wordle, I realized Josh Wardle had made what I consider a tragic mistake: Using LocalStorage to store content in the browser.

You see, the first time I tried Wordle was on my tablet. But suddenly, I wanted to give Wordle a shot on my phone... and I realized those treasured statistics wouldn't be there. And if I ever tried to play from my desktop, I'd be up a creek again. As I use three different devices, I'd have three different sets of statistics, all incomplete.

LocalStorage is popular for web apps because it is lazy: You don't need a server-side component and you don't need to manage users in any way. However, it's a fragile crutch, as browser privacy strategies are likely to blow away the assumed-to-be-non-critical data websites cache on browsers, and you lose any matter of cross-device, or even cross-browser access. It also isn't secure and often misused.

Browser-based storage is also a missed opportunity for sharing: Since arcade cabinets became popular decades ago, the simple high score list was a way for players to brag and share. With all data contained in an individual's own browser, this isn't possible. For all the benefits of social-media sharing Wordle, a whole potential experience is lost: The Wordle site doesn't let you see anything about how your various friends are doing in the game.

Recently, the New York Times purchased Wordle and has begun migrating it over to their site. However, this introduced a wrinkle, and exposed yet another flaw of LocalStorage: It's tied to a specific domain, and scattered on everyone's various web browsers. So the solution it appears they went with involved a customized redirect which grabs your Wordle data on the original site, and then passes it along to the New York Times site when it redirects. And of course, that introduced problems.

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.

I'm a user of Sandstorm.io as my app server of choice, and LocalStorage has always presented an issue for packaging Sandstorm apps: Apps are loaded on random hostnames each time for security reasons, hence losing access to any LocalStorage data from the previous load. Depending on the complexity of a given web app, sometimes it's possible to patch in decent server-side storage to an app built solely for LocalStorage.

Unfortunately in Wordle's case, while downloading a copy of it is easy, fixing it is not: It's not open source, and with the acquisition by the New York Times, probably never will be.