No caching in HTML5

In HTML4, we used things 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" /> 

so that the browser does not cache pages.

What should I use in HTML5 so that the browser does not cache my pages. I do not want all pages to be cached .

I saw something about

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

but it seems like a lot of work is to specify all the pages of the entire web application to prevent the browser from caching anything.

Is there an easier way?

If I omit part of the manifest from the html tag, will this make the browser not cache anything? I.e.

  <html> ... </html> 

Or will he assume that everything is in the cache?

+4
source share
3 answers

Answer # 12693786 may be helpful.

The following is an example of your-manifest-file to force an update of all resources.

 CACHE MANIFEST NETWORK: * 

and add the manifest attribute to the <html> element.

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

Required for all HTML files that you want to disable the cache.
It cannot be avoided because it is an HTML5 specification.

+3
source

Cache settings are optimally handled by response headers from the web server. I would investigate changing these settings. Including a header, for example:

 Cache-Control: max-age=0,no-cache,no-store,post-check=0,pre-check=0 

will stop all chaching in my experience. I have never had a consistent desired behavior setting cache behavior using meta tags in any version of HTML.

0
source

I think that if you do not specify a manifest attribute, it will not cache by default. I know that in firefox you can use additional tools like Firebug or HttpFox to check if the page is cached. Not sure about other browsers, but most likely it’s located on the Network tab of the developer’s tools.

-one
source

Source: https://habr.com/ru/post/1499644/


All Articles