is meta http-equiv value cache control is not supported?

后端 未结 2 426
独厮守ぢ
独厮守ぢ 2020-12-06 19:18

i have this code here on a page:



         


        
相关标签:
2条回答
  • 2020-12-06 19:49

    Only some headers are supported through the http-equiv attribute, and support is different in different browsers. For example, Mozilla only document support for:

    • content-language
    • Content-Security-Policy
    • content-type
    • default-style
    • refresh
    • set-cookie

    The intention was for servers to parse this header (meta http-equiv - is it sent as part of an HTTP header, or does the client parse the body for meta tags?), but this was never widely implemented. It is implemented by Apache httpd's mod_proxy:

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

    Using <meta> tags to turn off caching in all browsers? suggests a format that may work in more browsers but, in general, this is not a supported technique.

    0 讨论(0)
  • 2020-12-06 19:54

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

    So, your concrete problem is caused because those <meta http-equiv> tags are ignored.

    See also:

    • How to control web page caching, across all browsers?
    • Avoid back button on JSF web application
    0 讨论(0)
提交回复
热议问题