好吧,我一直在使用错误的代码,因为我不知道现在多久了 - 看起来
<meta http-equiv="expires" content="0">
错误的是下列正确的
<meta http-equiv="expires" content="mon, 27 sep 2010 14:30:00 GMT">
所以我的问题是,如果他们希望我像上面那样放置日期格式,我如何仍然让它成为 0
以及如何在没有 PHP/JavaScript 的情况下生成它?把它放在日期格式似乎很愚蠢。
最佳答案
你是not allowed在 HTML5 中使用 expires
pragma 指令,因为它是 not defined in the HTML5 spec也不registered在维基页面上 PragmaExtensions .
相反,您应该使用相应的 HTTP header 。
根据 RFC 4229 , Expires
header 字段在 RFC 2616 中定义, 它的定义非常清楚格式:
The format is an absolute date and time as defined by HTTP-date in section 3.3.1; it MUST be in RFC 1123 date format […]
请注意,它还说明了 0
值:
HTTP/1.1 clients and caches MUST treat other invalid date formats, especially including the value "0", as in the past (i.e., "already expired").
关于你应该做什么:
To mark a response as "already expired," an origin server sends an Expires date that is equal to the Date header value.
关于html - "Bad value expires for attribute http-equiv on element meta",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24773706/