简体   繁体   English

HTML meta http-equiv未显示

[英]HTML meta http-equiv not showing up

I'm a little bit confused, because the HTTP header I'm trying to set is not showing up when I try to inspect the HTTP response headers with curl or Chromes developer tools. 我有点困惑,因为当我尝试使用curl或Chromes开发人员工具检查HTTP响应标头时,没有显示要设置的HTTP标头。

I set the following header(s): 我设置了以下标头:

<html>
<head>
  <meta http-equiv="set-cookie" content="the_name=some_value; path=/" />
</head>
<body>
  <p>Hello World.</p>
</body>
</html>

I also tried to set the following header: 我还尝试设置以下标头:

<meta http-equiv="refresh" content="2;URL=http://www.example.com" />

If I set a header with PHP , it shows up: 如果我使用PHP设置标头,则会显示:

<head>
  <?php header("refresh:2; URL=site.php"); ?>
</head>

Why do the HTTP headers I try to set via HTML do not show up with curl -I or with Chrome's developer tools, what am I doing wrong? 为什么我尝试通过HTML设置的HTTP标头不会与curl -I或Chrome的开发人员工具一起显示,我在做什么错?

http-equiv tries to be equivalent to an HTTP header, it is not a way to set a real HTTP header. http-equiv尝试等效于HTTP标头,这不是设置真实 HTTP标头的方法。

  • Since it isn't a real HTTP header so won't show up if you look at the real HTTP headers. 由于它不是真实的HTTP标头,因此如果您查看真实的HTTP标头,则不会显示。
  • It isn't really equivalent, there are many limitations 它不是真正等效的,有很多限制
  • set-cookie is not a valid value for http-equiv set-cookie不是http-equiv的有效值

I don't have the tools to try this out at this second, but try changing the end of the tags to the proper version. 我没有工具可以在此进行尝试,但是请尝试将标签的结尾更改为正确的版本。

XML: XML:

" />

HTML: HTML:

 ">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM