Meta http-equiv value cache control not supported?

I have this code here on the page:

<!-- no cache headers --> <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="0" /> <!-- end no cache headers --> 

when I go to another page and click the browser button (back to the page where this code is written), it still has a page cache state. an option to add a PhaseListener, but they told me that adding a PhaseListener is additional support codes.

Question:
1. is the meta tag attribute http-equiv value cache-control still supported in html throughout the browser? because when I check w3school there is no value cache, pragma and expire for the http-equiv attribute.
2. If I add a PhaseListener, what would be the advantage over adding meta tags on every page?

thanks in advance

+4
source share
2 answers

The <meta http-equiv> tags are used only when the HTML file in question was opened from a non-HTTP resource, such as a local file system on disk (via file:// URI), and not when this HTML file was opened from real HTTP resource (via http:// URI). Instead, real HTTP response headers set through HttpServletResponse#setHeader() .

So your specific problem is because the <meta http-equiv> tags are ignored .

See also:

+7
source

Only http-equiv attributes are supported only by certain headers, and support for different browsers is different. For example, Mozilla only supports documentation :

  • language content
  • Content-Security-Policy
  • content type
  • Default style
  • Refresh
  • Set cookie

The servers were supposed to parse this header ( meta http-equiv - does it go as part of the HTTP header or does the client parse the body for meta tags? ), But this has never been widely implemented. It is implemented by Apache httpd mod_proxy :

Another effect of enabling ProxyHTMLMeta is to parse all <meta http-equiv=...> declarations and convert them to real HTTP headers in accordance with the original purpose of this form of the HTML <meta> element.

Using <meta> tags to disable caching in all browsers? offers a format that can work in more browsers but, in general, this is not a supported method.

+1
source

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


All Articles