HTML - <meta>
The HTML <meta>
element represents any metadata information that cannot be represented by one of the other HTML meta-related elements (<base>
, <link>
, <script>
, <style>
or <title>
).
Example
<!-- In HTML5 --> <meta charset="utf-8"> <!-- Defining the charset in HTML4 --> <!-- Note: This is invalid in HTML5 --> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- Redirect page after 3 seconds --> <meta http-equiv="refresh" content="3;url=http://www.mozilla.org/">
Description
The HTML <meta>
element represents any metadata information that cannot be represented by one of the other HTML meta-related elements (<base>
, <link>
, <script>
, <style>
or <title>
).
Depending on the attributes set, the kind of metadata can be one of the following:
- If
name
is set, it is document-level metadata, applying to the whole page. - If
http-equiv
is set, it is a pragma directive, i.e. information normally given by the web server about how the web page should be served. - If
charset
is set, it is a charset declaration, i.e. the charset used for the serialized form of the webpage. - If
itemprop
is set, it is user-defined metadata, transparent for the user-agent as the semantics of the metadata is user-specific.
Content categories | Metadata content. If the itemprop attribute is present: flow content, phrasing content. |
---|---|
Permitted content | None, it is an empty element. |
Tag omission | As it is a void element, the start tag must be present and the end tag must not be present |
Permitted parent elements | <meta charset> , <meta http-equiv> : a <head> element. If the http-equiv is not an encoding declaration, it can also be inside a <noscript> element, itself inside a <head> element. |
DOM interface | HTMLMetaElement |
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | 1.0 (1.7 or earlier) | (Yes) | (Yes) | (Yes) |
name="referrer" |
17 | 36.0 (36.0) [1] | ? | ? | ? |
Constrained to values listed under referrer (as specified in the spec.) | 46.0 |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 1.0 (1.0) | (Yes) | (Yes) | (Yes) | (Yes) |
name="referrer" |
? | (Yes) | 36.0 (36.0) [1] | ? | ? | ? | (Yes) |
Constrained to values listed under referrer (as specified in the spec.) | No support | 46.0 | ? | ? | ? | ? | 46.0 |
[1] The referrer
value wasn't taken into account when navigation was happening via the context menu or middle click until Firefox 39.
See Also
Specifications
Specification | Status | Comment |
---|---|---|
Referrer Policy The definition of '<meta name="referrer">' in that specification. |
Working Draft | Defines values and semantics of <meta name="referrer"> . |
WHATWG HTML Living Standard The definition of '<meta>' in that specification. |
Living Standard | Added itemprop attribute |
HTML5 The definition of '<meta>' in that specification. |
Recommendation | Added charset attribute |
HTML 4.01 Specification The definition of '<meta>' in that specification. |
Recommendation |
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/html/element/meta