http-equiv 属性定义了一个编译指示指令
实践:
1、
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/meta#attr-http-equiv
http-equiv
属性定义了一个编译指示指令。这个属性叫做 http-equiv(alent)
是因为所有允许的值都是特定 HTTP 头部的名称,如下:
content-security-policy
它允许页面作者定义当前页的内容策略。 内容策略主要指定允许的服务器源和脚本端点,这有助于防止跨站点脚本攻击。content-type
如果使用这个属性,其值必须是"text/html; charset=utf-8
"。注意:该属性只能用于 MIME type 为text/html
的文档,不能用于 MIME 类型为 XML 的文档。default-style
设置默认 CSS 样式表组的名称。
-
x-ua-compatible
如果指定,则content
属性必须具有值 "IE=edge
"。用户代理必须忽略此指示。 refresh
这个属性指定:
可访问性相关考虑
设置了 refresh
值的页面可能有时间间隔太短的风险。使用诸如屏幕朗读这样的辅助技术来浏览网页的人可能会由于自动跳转而来不及读完或理解网页的内容。这样不经提示而突然进行的页面刷新也可能会让有视力障碍的人群感到迷惑。
- MDN Understanding WCAG, Guideline 2.1 explanations (en-US)
- MDN Understanding WCAG, Guideline 3.1 explanations (en-US)
- Understanding Success Criterion 2.2.1 | W3C Understanding WCAG 2.0
- Understanding Success Criterion 2.2.4 | W3C Understanding WCAG 2.0
- Understanding Success Criterion 3.2.5 | W3C Understanding WCAG 2.0
Defines a pragma directive. The attribute is named http-equiv(alent)
because all the allowed values are names of particular HTTP headers:
content-security-policy
Allows page authors to define a content policy for the current page. Content policies mostly specify allowed server origins and script endpoints which help guard against cross-site scripting attacks.content-type
Declares the MIME type and character encoding of the document. If specified, thecontent
attribute must have the value "text/html; charset=utf-8
". This is equivalent to a<meta>
element with thecharset
attribute specified, and carries the same restriction on placement within the document. Note: Can only be used in documents served with atext/html
— not in documents served with an XML MIME type.default-style
Sets the name of the default CSS style sheet set.x-ua-compatible
If specified, thecontent
attribute must have the value "IE=edge
". User agents are required to ignore this pragma.refresh
This instruction specifies:- The number of seconds until the page should be reloaded - only if the
content
attribute contains a non-negative integer. - The number of seconds until the page should redirect to another - only if the
content
attribute contains a non-negative integer followed by the string ';url=
', and a valid URL.
ACCESSIBILITY CONCERNS
Pages set with arefresh
value run the risk of having the time interval being too short. People navigating with the aid of assistive technology such as a screen reader may be unable to read through and understand the page's content before being automatically redirected. The abrupt, unannounced updating of the page content may also be disorienting for people experiencing low vision conditions.- MDN Understanding WCAG, Guideline 2.1 explanations
- MDN Understanding WCAG, Guideline 3.1 explanations
- Understanding Success Criterion 2.2.1 | W3C Understanding WCAG 2.0
- Understanding Success Criterion 2.2.4 | W3C Understanding WCAG 2.0
- Understanding Success Criterion 3.2.5 | W3C Understanding WCAG 2.0
- The number of seconds until the page should be reloaded - only if the