Does localStorage ever expire?

4,847 views
Skip to first unread message

Eric Wong

unread,
Sep 27, 2010, 4:58:08 AM9/27/10
to Chromium HTML5
For regular cookies, we all know that we can set an expiry date for
it. However, is there a similar mechanism for localStorage? It seems
to me that localStorage does NOT have the equivalent of an expiry date
and will stay on a users hard drive forever. Does Chromium/Google
Chrome ever clean up old localStorage files that I see in the User-
Data folder for Chromium/Google Chrome?

Peter Beverloo

unread,
Sep 27, 2010, 5:03:08 AM9/27/10
to Eric Wong, Chromium HTML5
> --
> You received this message because you are subscribed to the Google Groups "Chromium HTML5" group.
> To post to this group, send email to chromiu...@chromium.org.
> To unsubscribe from this group, send email to chromium-html...@chromium.org.
> For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-html5/?hl=en.
>

localStorage does not expire by default, to cite the Web Storage
specification[1]:

"User agents should expire data from the local storage areas only for
security reasons or when requested to do so by the user"

I'm not sure whether Chromium removes or expires data based on
security reasons, but am not aware it does.

You can manually remove the information by going to the Settings,
"Under the Hood", "Clear browsing data.." and checking the "Delete
cookies and other site data" box.

Kind regards,
Peter Beverloo
http://peter.sh/

[1] http://dev.w3.org/html5/webstorage/

Eric Wong

unread,
Sep 27, 2010, 5:09:35 AM9/27/10
to Chromium HTML5
With the way Chromium/Google Chrome stores localStorage areas for each
subdomain/website as individual separate file on a user's hard drive,
this could lead to a very large number of files and performance
degradation as more websites use localStorage.

Jeremy Orlow

unread,
Sep 27, 2010, 6:38:13 AM9/27/10
to Eric Wong, Chromium HTML5
An interesting point.  But I think something that could be mitigated fairly easily when it does indeed become a problem, so it's not a fundamental flaw with the spec or anything.  I filed https://bugs.webkit.org/show_bug.cgi?id=46615 to track the issue.

Btw, note that there's been talk off and on about adding expiration to the spec, but it'd be an optional feature.

J
Reply all
Reply to author
Forward
0 new messages