W3cubDocs

/Web APIs

HTMLMetaElement: httpEquiv property

The HTMLMetaElement.httpEquiv property gets or sets the pragma directive or an HTTP response header name for the HTMLMetaElement.content attribute. For more details on the possible values, see the http-equiv attribute.

Value

A string.

Examples

Reading the http-equiv value of a meta element

The following example queries a <meta> element with an http-equiv attribute. The http-equiv attribute is logged to the console showing a refresh pragma directive that instructs the browser to refresh the page after a number of seconds defined by the content attribute:

js

// given <meta http-equiv="refresh" content="10" />
let meta = document.querySelector("meta[http-equiv]");
console.log(meta.httpEquiv);
// refresh
console.log(meta.content);
// 10

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
httpEquiv 1 12 1 5.5 ≤12.1 1 4.4 18 4 ≤12.1 1 1.0

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMetaElement/httpEquiv