Idea: keep clientside js in localStorage

1 points by dominictarr ↗ HN
client side javascripters aim for minimal code, to optimise load times; but what if you didn't have to worry about that? My idea is to store slowly changing assets in localStorage and then just have a tiny js that loads them into the page.

has anyone attempted this before?

5 comments

[ 5.6 ms ] story [ 19.0 ms ] thread
Is this really necessary when you already have browser caching? Which is fairly robust/mature across the market.
the problem with browser caching is that you cannot control when you want it to update, except with a timeout.
Timeout isn't the only way. You could set a version variable on pageload, and have a conditional version check on init. If the versions match and localstorage exists, load from localstorage, if not, grab from the server and update.