- : The metadata element
- Attributes
- Examples
- Specifications
- Browser compatibility
- See also
- Found a content problem with this page?
- MDN
- Support
- Our communities
- Developers
- Saved searches
- Use saved searches to filter your results more quickly
- content-type application/xhtml+xml meta tag #418
- content-type application/xhtml+xml meta tag #418
- Comments
: The metadata element
The HTML element represents metadata that cannot be represented by other HTML meta-related elements, like , , , or .
- , : a element. If the http-equiv is not an encoding declaration, it can also be inside a element, itself inside a element.
- : any element that accepts metadata content.
- : any element that accepts metadata content or flow content.
The type of metadata provided by the element can be one of the following:
- If the name attribute is set, the element provides document-level metadata, applying to the whole page.
- If the http-equiv attribute is set, the element is a pragma directive, providing information equivalent to what can be given by a similarly-named HTTP header.
- If the charset attribute is set, the element is a charset declaration, giving the character encoding in which the document is encoded.
- If the itemprop attribute is set, the element provides user-defined metadata.
Attributes
This element includes the global attributes.
Note: the attribute name has a specific meaning for the element, and the itemprop attribute must not be set on the same element that has any existing name , http-equiv or charset attributes.
This attribute declares the document’s character encoding. If the attribute is present, its value must be an ASCII case-insensitive match for the string «utf-8» , because UTF-8 is the only valid encoding for HTML5 documents. elements which declare a character encoding must be located entirely within the first 1024 bytes of the document.
This attribute contains the value for the http-equiv or name attribute, depending on which is used.
Defines a pragma directive. The attribute is named http-equiv(alent) because all the allowed values are names of particular HTTP headers:
- content-security-policy Allows page authors to define a content policy for the current page. Content policies mostly specify allowed server origins and script endpoints which help guard against cross-site scripting attacks.
- content-type Declares the MIME type and the document’s character encoding. The content attribute must have the value «text/html; charset=utf-8» if specified. This is equivalent to a element with the charset attribute specified and carries the same restriction on placement within the document. Note: Can only be used in documents served with a text/html — not in documents served with an XML MIME type.
- default-style Sets the name of the default CSS style sheet set.
- x-ua-compatible If specified, the content attribute must have the value «IE=edge» . User agents are required to ignore this pragma.
- refresh This instruction specifies:
- The number of seconds until the page should be reloaded — only if the content attribute contains a non-negative integer.
- The number of seconds until the page should redirect to another — only if the content attribute contains a non-negative integer followed by the string ‘ ;url= ‘, and a valid URL.
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.
The name and content attributes can be used together to provide document metadata in terms of name-value pairs, with the name attribute giving the metadata name, and the content attribute giving the value.
See standard metadata names for details about the set of standard metadata names defined in the HTML specification.
Examples
meta charset="utf-8" /> meta http-equiv="refresh" content="3;url=https://www.mozilla.org" />
Specifications
Browser compatibility
BCD tables only load in the browser
See also
Found a content problem with this page?
This page was last modified on Jul 18, 2023 by MDN contributors.
Your blueprint for a better internet.
MDN
Support
Our communities
Developers
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998– 2023 by individual mozilla.org contributors. Content available under a Creative Commons license.Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
content-type application/xhtml+xml meta tag #418
content-type application/xhtml+xml meta tag #418
Comments
This issue (#135 — content-type value should be allowed for http-equiv attribute of meta tag) was closed in Jan 2012 but since then standards have been updated and I believe makes this issue a valid issue and an bug in ePubCheck.
Up to Draft 28 (May 2013) the statement was:-
http://www.w3.org/TR/2013/WD-html51-20130528/document-metadata.html#pragma-directives
«The Encoding declaration state may be used in HTML documents, but elements with an http-equiv attribute in that state must not be used in XML documents.»Which is contradictory as is required to make the intended XHTML5 file. Else it is technically a HTML5 file that is still valid as it accepts the ‘look’ of a XHTML5 file but may not be parsed/validated correctly by XML engines.
After that (Draft 29 (October 2013) to Current) the statement is:-
http://www.w3.org/TR/2013/WD-html51-20131029/document-metadata.html#pragma-directives
«The encoding declaration state may be used in HTML documents and in XML Documents. If the encoding declaration state is used in XML Documents, the name of the character encoding must be an ASCII case-insensitive match for the string «UTF-8″ (and the document is therefore forced to use UTF-8 as its encoding).»The text was updated successfully, but these errors were encountered: