http-equiv 与 HTML 文档的相关性是什么?

What is the relevance http-equiv to a HTML document?

http-equiv 与 HTML 文档的相关性是什么?它们是在文档发送到浏览器时使用,还是在文档发送请求时使用?

来自source

By using the so called HTTP-EQUIV tag you are able to add certain values to your website. HTTP-EQUIV meta tags define the header of an HTML document. This is a section of code that is sent to your browser before the rest of the page. It communicates to your browser certain introductory information about the page. You can think of it as a "Hello, I am a HTML page. I was born on such-and-such a date and live on such-and-such a server. I was last modified on such-and-such a day, etc...

Where do you add this http-equiv= tag?

You may add this http-equiv= tag to all of your webpages, so not only in the first index page. Make sure that on every page relevant meta tags are added. Add keywords and phrases that are relevant and correspond to the text and the language on that specific page. It might be a lot of work to add specific meta tags to each page but you will notice in time that it works!

另请注意

HTML 4.01: 元 http-equiv="content-type" 内容="text/html; charset=UTF-8"

HTML5: 元字符集="UTF-8"

在现代使用中,http-equiv 最常用于强制 IE 进入边缘模式。

例如<meta http-equiv="x-ua-compatible" content="IE=edge"

但除此之外还有很多其他用途

HTTP-EQUIV 元标记定义 HTML 文档的 header。这是在页面其余部分之前发送到浏览器的一段代码。

http-equiv 的值因您使用它的方式而异。它可能包含以下任何值:

  • "Allow"
  • "Content-Encoding"
  • "Content-Language"
  • "Content-Length"
  • "Content-Type"
  • "Date"
  • "Expires"
  • "Last-Modified"
  • "Location"
  • "Refresh"
  • "Set-Cookie"
  • "WWW-Authenticate"

可在此处找到有关每个值的其他信息:http://www.w3.org/TR/html5/document-metadata.html

http-equiv 用于模拟 http Header

虽然http-equiv是为包含HTTP头信息而设计的,但除了"Content-Type"和"X-UA-Compatible"的值(在IE8中引入以处理标准兼容性)之外,它没有太多应用。 from sitepoint.com