docs.rodeo

MDN Web Docs mirror

http-equiv attribute

{{HTMLSidebar}} 

The http-equiv attribute of the {{htmlelement("meta")}}  element allows you to provide processing instructions for the browser as if the response that returned the document included certain HTTP headers. The metadata is document-level metadata that applies to the whole page.

When a <meta> element has an http-equiv attribute, a content attribute defines the corresponding http-equiv value. For example, the following <meta> tag tells the browser to refresh the page after 5 minutes:

<meta http-equiv="Refresh" content="300" />

Value

Only a subset of the HTTP headers are supported as http-equiv values. These include:

[!WARNING] Some browsers process additional headers that are not listed above. Since unrecognized headers or invalid values are ignored, this can lead to inconsistent behavior across browser implementations. In particular, Do not set other security headers using <meta http-equiv=, as this can lead to a false sense of security!

Accessibility concerns

Pages set with a http-equiv="Refresh" value run the risk of having the refresh 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. Abrupt, unannounced page updates may also be disorienting for people experiencing low vision conditions.

Examples

Disable unsafe inline code and only allow HTTPS resources

This HTML <meta> element sets the default CSP to only allow resource loading (images, fonts, scripts, etc.) over HTTPS. Because the unsafe-inline and unsafe-eval directives are not set, inline scripts will be blocked:

<meta http-equiv="Content-Security-Policy" content="default-src https:" />

The same restrictions can be applied using the HTTP {{httpheader("Content-Security-Policy")}}  header:

Content-Security-Policy: default-src https:

Setting a page redirect

The following example uses http-equiv="refresh" to direct the browser to perform a redirect. The content="3;url=https://www.mozilla.org" attribute will redirect page to https://www.mozilla.org after 3 seconds:

<meta http-equiv="refresh" content="3;url=https://www.mozilla.org" />

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN