Reputation: 333
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?
Upvotes: 7
Views: 24856
Reputation: 433
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.
Upvotes: 4
Reputation: 2550
Cache settings are optimally handled by the response headers from the web server. I would research changing those settings. Including a header like:
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 consistent desired behavior setting cache behavior using meta tags in any version of HTML.
Upvotes: 2
Reputation: 93
I think if you leave out the manifest attribute, it defaults to no cache. I know that on firefox, you can use add-on tools like Firebug or HttpFox to check if the page is cached. Not sure about other browsers, but most likely it's under "Network" tab of developer tools.
Upvotes: 0