What is the point of storing JS and CSS in localstorage?

Viewed 263

While reading Stoyan Stefanov's web performance daybook I have encountered the following:

Google and Bing store JavaScript and CSS in localStorage to improve their mobile site performance

and the link to the blog with a description. Nonetheless I read it (and have reasonable experience working with localstorage), I sill can not understand what is the point of such action. In my opinion the browser is already doing a job of caching CSS and JS and there is absolutely no point to store them in localstorage.

Can anyone explain in simple English what is the reason?

P.S. In the beginning I thought that may be it has something to do with the size of the cache of mobile browsers, but when I checked I found that they have more then 20Mb of cache which (in my opinion) is pretty enough to make sure that such popular sites like google and bing will have place to be cached.

1 Answers

+1, Nice question. The only reason I can think of is for speed of load time, in those cases were it is no longer stored in the cache. Also, as the post you linked to pointed out, it makes their HTML files a lot smaller ---200kb to39kb is a big difference.

EDIT:

You asked in what conditions would it no longer be in the cache. From my understanding of how the cache works, I believe that the cache size is fixed, so after a while those files would get pushed out to make room for more files. Hope it helps

Related