I am learning about localStorage, and I understand that the limit is 5MB per domain. The first thought that crossed my mind is that an average web user visits hundred of websites regularly. If each one of these sites used their 5MB quota, the user could have multiple Gigabytes of storage on his disk dedicated to localStorage for his browser, which seems kind of crazy, especially for an ignorant user who might not be aware.
Now, I found my localStorage file in Firefox and it is only 2MB (and I’ve been recycling my user profile directory for years, so I expected it to be huge), so apparently either not many sites use it, or they clear it out often, or I don’t know what. But hypothetically it seems like a lot more space could get used, and in some cases wasted.
Is this a valid concern? I couldn’t find any discussion of this topic anywhere…
Whilst people may visit many websites daily, most of them would not be regular. Google, stack overflow, facebook, gmail, youtube, x newspaper and 9gag may be an average casual browsing session. Provided websites are using local storage responsibly, that is storing data for a valid purpose and only when a user “registers” to a site (or specifically requests local storage) rather than every passing visitor, then I think it’s a non-issue. It should be the responsibility of the browser to keep an eye on the storage size, and if necessary prompt the user to clear infrequently used data. Web browsers have been caching images from every website you happen to have visited in the history of the universe for a while now, I wouldn’t say we’ve brought about a massive storage crisis. I would also question the impact of reaching a gigabyte of local storage anyway, given even budget laptops these days come with half a terabyte of hard disk space.