--- title: ': The Document-level Metadata element' slug: Web/HTML/Element/meta translation_of: Web/HTML/Element/meta ---
The HTML <meta>
element represents {{Glossary("Metadata","metadata")}} that cannot be represented by other HTML meta-related elements, like {{HTMLElement("base")}}, {{HTMLElement("link")}}, {{HTMLElement("script")}}, {{HTMLElement("style")}} or {{HTMLElement("title")}}.
Content categories | Metadata content. If the {{htmlattrxref("itemprop", "meta")}} attribute is present: flow content, phrasing content. |
---|---|
Permitted content | None, it is an {{Glossary("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 {{HTMLElement("head")}} element. If the {{htmlattrxref("http-equiv", "meta")}} is not an encoding declaration, it can also be inside a {{HTMLElement("noscript")}} element, itself inside a {{HTMLElement("head")}} element. |
Permitted ARIA roles | None |
DOM interface | {{domxref("HTMLMetaElement")}} |
This element includes the global attributes.
Note: the global attribute {{htmlattrxref("name", "meta")}} has a specific meaning for the {{HTMLElement("meta")}} element, and the {{htmlattrxref("itemprop", "meta")}} attribute must not be set on the same <meta>
element that has any existing {{htmlattrxref("name", "meta")}}, {{htmlattrxref("http-equiv", "meta")}} or {{htmlattrxref("charset", "meta")}} attributes.
UTF-8
.JIS_C6226-1983
, JIS_X0212-1990
, HZ-GB-2312
, JOHAB
, the ISO-2022 family and the EBCDIC family.Note: ASCII-incompatible encodings are those that don't map the 8-bit code points 0x20
to 0x7E
to the 0x0020
to 0x007E
Unicode code points)
CESU-8
, UTF-7
, BOCU-1
and/or SCSU
as cross-site scripting attacks with these encodings have been demonstrated.UTF-32
because not all HTML5 encoding algorithms can distinguish it from UTF-16
.Content-Type
header and any {{Glossary("Byte-Order Mark","Byte-Order Marks")}} override this element.UTF-7
fallback cross-scripting technique.charset
attribute is a synonym for the pre-HTML5 <meta http-equiv="Content-Type" content="text/html; charset=IANAcharset">
, where IANAcharset
contains the value of the equivalent {{htmlattrxref("charset", "meta")}} attribute. This syntax is still allowed, although no longer recommended.http-equiv(alent)
because all the allowed values are names of particular HTTP headers:
"content-language"
{{obsolete_inline}}Warning: Do not use this value, as it is obsolete. Prefer the lang
attribute on the {{HTMLElement("html")}} element.
"content-security-policy"
"content-type"
{{obsolete_inline}}content-type
entity-header field, but as it is inside a HTML page, most values other than text/html
are impossible. Therefore the valid syntax for its content
is the string 'text/html
' 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.
Warning: Do not use this value, as it is obsolete. Use the {{htmlattrxref("charset", "meta")}} attribute on the {{HTMLElement("meta")}} element.
Note: As {{HTMLElement("meta")}} can't change documents' types in XHTML or HTML5's XHTML serialization, never set the MIME type to an XHTML MIME type with <meta>
.
"refresh"
;url=
', and a valid URL."set-cookie"
{{obsolete_inline}}Warning: Do not use this instruction, as it is obsolete. Use the HTTP header Set-Cookie
instead.
This attribute defines the name of a piece of document-level metadata. It should not be set if one of the attributes {{htmlattrxref("itemprop", "meta")}}, {{htmlattrxref("http-equiv", "meta")}} or {{htmlattrxref("charset", "meta")}} is also set.
This metadata name is associated with the value contained by the {{htmlattrxref("content", "meta")}} attribute. The possible values for the name attribute are:
application-name
which defines the name of the application running in the web page.
author
which defines the name of the document's author.description
which contains a short and accurate summary of the content of the page. Several browsers, like Firefox and Opera, use this as the default description of bookmarked pages.generator
which contains the identifier of the software that generated the page.keywords
which contains words relevant to the page's content separated by commas.referrer
which controls the Referer
HTTP header attached to requests sent from the document:
no-referrer |
Do not send a HTTP Referrer header. |
origin |
Send the origin of the document. |
no-referrer-when-downgrade |
Send the origin as a referrer to URLs as secure as the current page, (https→https), but does not send a referrer to less secure URLs (https→http). This is the default behaviour. |
origin-when-cross-origin |
Send the full URL (stripped of parameters) for same-origin requests, but only send the origin for other cases. |
same-origin |
A referrer will be sent for same-site origins, but cross-origin requests will contain no referrer information. |
strict-origin |
Only send the origin of the document as the referrer to a-priori as-much-secure destination (HTTPS->HTTPS), but don't send it to a less secure destination (HTTPS->HTTP). |
strict-origin-when-cross-origin |
Send a full URL when performing a same-origin request, only send the origin of the document to a-priori as-much-secure destination (HTTPS->HTTPS), and send no header to a less secure destination (HTTPS->HTTP). |
unsafe-URL |
Send the full URL (stripped of parameters) for same-origin or cross-origin requests. |
Notes:
always
, default
, and never
for referrer.<meta name="referrer">
(with document.write
or appendChild
) makes the referrer behaviour unpredictable.This 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:
creator
which defines the name of the creator of the document, such as an organization or institution. If there are more than one, several {{HTMLElement("meta")}} elements should be used.googlebot
, a synonym of robots
, is only followed by Googlebot (the indexing crawler for Google).publisher
which defines the name of the document's publisher.robots
which defines the behaviour that cooperative crawlers, or "robots", should use with the page. It is a comma-separated list of the values below:
Value | Description | Used by |
---|---|---|
index |
Allows the robot to index the page (default). | All |
noindex |
Requests the robot to not index the page. | All |
follow |
Allows the robot to follow the links on the page (default). | All |
nofollow |
Requests the robot to not follow the links on the page. | All |
none |
Equivalent to noindex, nofollow |
|
noodp |
Prevents using the Open Directory Project description, if any, as the page description in search engine results. | |
noarchive |
Requests the search engine not to cache the page content. | Google, Yahoo, Bing |
nosnippet |
Prevents displaying any description of the page in search engine results. | Google, Bing |
noimageindex |
Requests this page not to appear as the referring page of an indexed image. | |
nocache |
Synonym of noarchive . |
Bing |
noindex
will work, but only after the robot visits the page again. Ensure that the robots.txt
file is not preventing revisits.index
and noindex
, or follow
and nofollow
. In these cases the robot's behaviour is undefined and may vary between them.X-Robots-Tag
; this allows non-HTML documents like images to use these rules.slurp
, is a synonym of robots
, but only for Slurp - the crawler for Yahoo Search.viewport
, which gives hints about the size of the initial size of the {{glossary("viewport")}}. Used by mobile devices only.
Value | Possible subvalues | Description |
---|---|---|
width |
A positive integer number, or the text device-width |
Defines the pixel width of the viewport that you want the web site to be rendered at. |
height |
A positive integer, or the text device-height |
Defines the height of the viewport. Not used by any browser. |
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 amount to zoom in. It must be greater or equal to the minimum-scale or the behaviour is undefined. Browser settings can ignore this rule and iOS10+ ignores it by default. |
minimum-scale |
A positive number between 0.0 and 10.0 |
Defines the minimum zoom level. It must be smaller or equal to the maximum-scale or the behaviour is undefined. Browser settings can ignore this rule and iOS10+ ignores it by default. |
user-scalable |
yes or no |
If set to no , the user is not able to zoom in the webpage. The default is yes . Browser settings can ignore this rule, and iOS10+ ignores it by default. |
Specification | Status | Comment |
---|---|---|
{{SpecName('CSS3 Device', '#viewport-meta', '<meta name="viewport">')}} | {{Spec2('CSS3 Device')}} | Non-normatively describes the Viewport META element |
Warning: Do not use this value, as it is obsolete. There is no replacement as there was no real usage for it.
Depending on the attributes set, the kind of metadata can be one of the following:
<meta charset="utf-8"> <!-- Redirect page after 3 seconds --> <meta http-equiv="refresh" content="3;url=https://www.mozilla.org">
Pages set with a refresh
value run the risk of having the time 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. The abrupt, unannounced updating of the page content may also be disorienting for people experiencing low vision conditions.
Disabling zooming capabilities by setting user-scalable
to a value of no
prevents people experiencing low vision conditions from being able to read and understand page content.
Specification | Status | Comment |
---|---|---|
{{SpecName('Referrer Policy', '#referrer-policy-delivery-meta', '<meta name="referrer">')}} | {{Spec2('Referrer Policy')}} | Defines values and semantics of <meta name="referrer"> . |
{{SpecName('HTML WHATWG', 'semantics.html#the-meta-element', '<meta>')}} | {{Spec2('HTML WHATWG')}} | Added itemprop attribute |
{{SpecName('HTML5 W3C', 'document-metadata.html#the-meta-element', '<meta>')}} | {{Spec2('HTML5 W3C')}} | Added charset attribute |
{{SpecName('HTML4.01', 'struct/global.html#h-7.4.4.2', '<meta>')}} | {{Spec2('HTML4.01')}} |
The information shown below has been pulled from MDN's Github (https://github.com/mdn/browser-compat-data).
The compatibility table in 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.
{{Compat("html.elements.meta")}}