4

I am a little slow to the HTML5 caching, I have just some simple questions though.

1) How long is data in a caching manifest cached?

2) If I update the data, how can I make sure the client checks for a newer version when it is available, or is this already done?

3) Also, is this completely useless for a non-0mobile environment or can it speed up load times on a desktop?

<html lang="en" manifest="offline.manifest">

offline.manifest

CACHE MANIFEST
index.html
style.css
image.jpg
image-med.jpg
image-small.jpg
notre-dame.jpg
JasonDavis
  • 48,204
  • 100
  • 318
  • 537

2 Answers2

2

1) As long as the user cares to cache it. The only way to completely get rid of the cache is to go into the browser settings and explicitly remove it.

2) If you update the manifest file, the client will download new versions of all the files. This download is still governed by 'old' HTTP caching rules, so set headers appropriately, also make sure you send a 'no-cache' header on the manifest file itself. The rules from HTML5 Boilerplate are probably a good place to start.

3) Remember desktops can lose connectivity too. Also, having files in application cache means they are always served locally so, providing you're sensible about what you put in it, the application cache can reduce bandwidth and latency. What I mean by sensible is: if most visitors only see a couple of pages of your site and you update the manifest of your entire site every week, then they could end up using more bandwidth if you're forcing them to cache a load of static files for pages they never look at.

To really cut down on bandwidth and latency in your HTML5 website of the future: use the application cache for all your assets and a static framework; use something like mustache to render all your content from JSON; send that JSON over Web Sockets instead of HTTP, saving you ~800 bytes and a two way network handshake per request; cache data with Local Storage to save you fetching it again, and manage navigation with the History API.

robertc
  • 74,533
  • 18
  • 193
  • 177
  • application cache is deprecated now: https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache – CLo Feb 14 '16 at 04:19
0

1) How long is data in a caching manifest cached?

Once an application is cached, it remains cached until one of the following happens: The user clears the browser's cache The manifest file is modified The application cache is programatically updated

2) If I update the data, how can I make sure the client checks for a newer version when it is available, or is this already done?

you can specify witch files not to cache (NETWORK:) If you want to update your cached files, you should modify something in the manifest file, the best way is to put comment in the file and change it when you want the browser to update the cache

3) Also, is this completely useless for a non-mobile environment or can it speed up load times on a desktop?

Yes it is useful, cause the internet can cut on all devices

z0r0
  • 666
  • 4
  • 14