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>
).
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 parents |
<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. |
Permitted ARIA roles | None |
DOM interface | HTMLMetaElement |
This element includes the global attributes.
Note that the global name
has a specific semantic in the <meta>
element and that the itemprop
must not be set when one of the name
, http-equiv
or charset
is already used.
charset
<meta>
element must be inside the <head>
element and within the 1024 first bytes of the page, as some browsers only look at these first bytes before choosing a character set for the page.<meta>
element is only a part of the algorithm to determine the character set of a page that browsers apply. The HTTP Content-Type header and any BOM elements have precedence over this element.<meta>
element is a synonym for the pre-HTML5 <meta http-equiv="Content-Type" content="text/html; charset=IANAcharset">
where IANAcharset
corresponds of the value of the equivalent charset
attribute. This syntax is still allowed, although obsolete and no longer recommended.content
http-equiv
or name
attribute, depending on the context.http-equiv
content
and can be one of the following: "content-language"
deletedlang
attribute on the <html>
element instead."Content-Security-Policy"
"content-type"
deletedcontent-type
entity-header field, but as it is inside an HTML Element, most values are not possible. Therefore the valid syntax for its content is the literal string 'text/html
' eventually followed by a character set with the following syntax:'; charset=
IANAcharset
' where IANAcharset
is the preferred MIME name for a character set as defined by the IANA. charset
attribute on the <meta>
element instead.<meta>
may not be used to change the type of a document in an XHTML document, or in an HTML5 document following the XHTML syntax, never set MIME type to an XHTML MIME type that way. It would be incorrect.charset
attribute."default-style"
content
attribute must contain the title of a <link>
element whose href
attribute links to a CSS stylesheet, or the title of a <style>
element which contains a CSS stylesheet."refresh"
content
attribute contains only a positive integer number;content
attribute contains a positive integer number followed by the string ';url=
' and a valid URL."set-cookie"
deletedname
itemprop
, http-equiv
or charset
is also set.content
attribute. The possible values for the name element are, with their associated value, stored via the content
attribute: application-name
, defining the name of the web application running in the webpage; <title>
element, which usually consist of the application name but may also contain specific information like the document name or a status;author
, defining, in a free format, the name of the author of the document;description
, containing a short and accurate summary of the content of the page. Several browsers, among them Firefox and Opera, use this meta as the default description of the page when bookmarked;generator
, containing, in a free format, the identifier to the software that generated the page;keywords
, containing, as strings separated by commas, relevant words associated with the content of the page;referrer
controlling the content of the HTTP Referer
HTTP header attached to any request sent from this document: no-referrer | Do not send a HTTP Referer header. |
origin | Send the origin of the document. |
no-referrer-when-downgrade | Send the origin as referrer to a-priori as-much-secure destination (https->https), but doesn't send a referrer to a less secure destination (https->http). This is the default behavior. |
origin-when-crossorigin | Send a full URL (stripped from parameters) when performing a same-origin request, but only send the origin of the document for other cases. |
unsafe-URL | Send a full URL (stripped from parameters) when perfoming a a same-origin or cross-origin request. |
Note: Some browsers support keywords always
, default
, and never
for referrer. These values are deprecated.
<meta name="referrer">
(by document.write or appendChild) create a non-determinism when it comes to sending referrers or not. Note also that when several conflicting policies are defined, the No-referrer policy is applied.The attribute may also have a value taken from the extended list defined on WHATWG Wiki MetaExtensions page. Although none have been formally accepted yet, a few commonly used names are among the proposals:
creator
, defining, in a free format, the name of the creator of the document. Note that it can be the name of the institution. If there are more than one, several <meta>
elements should be used;googlebot
, which is a synonym of robots
, but is only followed by Googlebot, the indexing crawler for Google;publisher
, defining, in a free format, the name of the publisher of the document. Note that it can be the name of the institution;robots
, defining the behavior that cooperative crawlers should have with the page. It is a comma-separated list of values from the following list: Value | Description | Used by |
---|---|---|
index | Allows the robot to index the page | All |
noindex | Prevents the robot from indexing the page | All |
follow | Allows the robot to follow the links on the page | All |
nofollow | Prevents the robot from following the links on the page | All |
noodp | Prevents the usage of the Open Directory Project description, if any, as the description of the page in the search engine results page | |
noarchive | Prevents the search engine from caching the content of the page | Google, Yahoo |
nosnippet | Prevents the display of any description of the page in the search engine results page | |
noimageindex | Prevents this page from appearing as the referring page of an indexed image | |
nocache | Synonym of noarchive
| Bing |
noindex
will work, but only when the robot visits the page again. Ensure that the robots.txt file is not preventing such visits. Some search engines have developer's tools, allowing a quick removal of some page.index
and noindex
, or follow
and nofollow
, at the same time. In these cases the behavior of the robot is undefined, and may vary from one to the other. So avoid these cases.X-Robot-Tags
: this allows them to use these pragma on non-HTML documents, like images.slurp
, which is a synonym of robots
, but is only followed by Slurp, the indexing crawler for Yahoo Search;Finally a few names are in common use, though not in the process of being standardized:
viewport
, which gives hints about the size of the initial size of the viewport. This pragma is used by several mobile devices only. Value | Possible values | Description |
---|---|---|
width | a positive integer number or the literal device-width
| defines the width, in pixels, of the viewport |
height | a positive integer number or the literal device-height
| defines the height, in pixels, of the viewport |
initial-scale | a positive number between 0.0 and 10.0
| defines the ratio between the device width (device-width in portrait mode or device-height in landscape mode) and the viewport size. |
maximum-scale | a positive number between 0.0 and 10.0
| defines the maximum value of the zoom; it must be greater or equal to the minimum-scale or the behavior is indeterminate. |
minimum-scale | a positive number between 0.0 and 10.0
| defines the minimum value of the zoom; it must be smaller or equal to the maximum-scale or the behavior is indeterminate. |
user-scalable | a boolean value (yes or no ) | If set to no , the user is not able to zoom in the webpage. Default value is yes . |
Specification | Status | Comment |
---|---|---|
CSS Device Adaptation The definition of '<meta name="viewport">' in that specification. | Working Draft | Non-normatively describes the Viewport META element |
@viewport
scheme
deletedcontent
value, like a format. Depending on the attributes set, the kind of metadata can be one of the following:
name
is set, it is document-level metadata, applying to the whole page.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.charset
is set, it is a charset declaration, i.e. the charset used for the serialized form of the webpage.itemprop
is set, it is user-defined metadata, transparent for the user-agent as the semantics of the metadata is user-specific.
<!-- In HTML5 --> <meta charset="utf-8"> <!-- Redirect page after 3 seconds --> <meta http-equiv="refresh" content="3;url=https://www.mozilla.org/">
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 |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | (Yes) | (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 | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | (Yes) | (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.
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta