No caching in HTML5

Tika picture Tika · Aug 29, 2013 · Viewed 20k times · Source

In HTML4 we used stuff like

    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
    <meta http-equiv="Expires" content="Thu, 01 Jan 1970 00:00:00 GMT" />

to get the browser to not cache the pages.

What should I use in HTML5 to get the browser not to cache my pages. I don't want any pages at all cached.

I've seen something about

    <html manifest="example.appcache">
      ...
    </html>

but it seems like a lot of work to specify all the pages in the whole web application just to get the browser not to cache anything.

Is there a simpler way?

If I omitt the manifest part from the html tag, will that make the browser not cache anything? I.e.

    <html>
      ...
    </html>

Or will it take that as an ok to cache everything?

Answer

hidekuro picture hidekuro · Jun 4, 2014

Answer#12693786 might be helpful.

Here is an example of your-manifest-file to force updates to all resources.

CACHE MANIFEST
NETWORK:
*

and append manifest attribute to <html> element.

<html manifest="your-manifest-file">

Required for all HTML files you want to disable cache.
Can not be avoided because it is specification of HTML5.