views:

41

answers:

1

If I add some data to the browser's local storage, does it expire naturally? I'm thinking of storing some data with HTML 5 local storage, but the nature of it means it would expire after a few weeks.

So I'm wondering if there is a method to check if the data needs updating? Or simply update the data every few weeks.

+1  A: 

From the W3C draft:

User agents should expire data from the local storage areas only for security reasons or when requested to do so by the user. User agents should always avoid deleting data while a script that could access that data is running.

You'll want to do your updates on your schedule using setItem(key, value); that will either add or update the given key with the new data.

FatherStorm
Hmm... perhaps listing a date as part of the data would be a good idea? Or maybe using a different key each time the data changes.
DisgruntledGoat