HTMLMetaElement:httpEquiv 属性
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
HTMLMetaElement.httpEquiv
属性读取或设置 HTMLMetaElement.content
属性对应的 pragma 指令或 HTTP 响应标头名称。关于可能值的更多细节,请参阅 http-equiv 属性。
值
一个字符串。
示例
读取 meta 元素的 http-equiv
值
以下示例查询一个 <meta>
元素的 http-equiv
属性。http-equiv
属性被输出到控制台,以显示 refresh
pragma 指令,它指示浏览器在 content
属性定义的秒数后刷新页面:
js
// 假设 <meta http-equiv="refresh" content="10" />
const meta = document.querySelector("meta[http-equiv]");
console.log(meta.httpEquiv);
// refresh
console.log(meta.content);
// 10
规范
Specification |
---|
HTML # dom-meta-httpequiv |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
httpEquiv |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.