HTML <meta> http-equiv Attribute
HTML <meta> http-equiv Attribute
Example
Use the http-equiv attribute to define the character set for an HTML document:
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
</head>
Browser Support
The http-equiv attribute is supported in all major browsers.
Definition and Usage
The http-equiv attribute provides an HTTP header for the information/value of the content attribute.
The http-equiv attribute can be used to simulate an HTTP response header.
If the name attribute is set, the http-equiv attribute should not be set.
Syntax
Attribute Values
Some commonly used HTTP-header values are:
Value | Description |
---|---|
cache-control | Controls the caching mechanism to use for the document.
Available values:
Example: <meta http-equiv="cache-control" content="no-cache" /> |
content-language | Specifies the natural language(s) of the document (used by search engines to categorize pages by language).
Example: <meta http-equiv="content-language" content="en-US" /> |
content-type | Specifies the character set for the contents of the document.
Tip: It is recommended to always specify the character set. Example: <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> |
date | Specifies the date and time when the page was created.
Example: <meta http-equiv="date" content="Wed, 16 Feb 2011 22:34:13 GMT" /> |
expires | Specifies the date and time when the page will expire.
Example: <meta http-equiv="expires" content="Fri, 30 Dec 2011 12:00:00 GMT" /> |
last-modified | Specifies the last modification date.
Example: <meta http-equiv="last-modified" content="Mon, 03 Jan 2011 17:45:57 GMT" /> |
location | Redirects the visitor to another location.
Example: <meta http-equiv="location" content="URL=http://www.w3schools.com" /> |
refresh | Defines a time interval for the document to refresh itself.
Example: <meta http-equiv="refresh" content="300" /> Note: The value "refresh" should be used carefully, as it takes the control of a page away from the user. Using "refresh" will cause a failure in W3C's Web Content Accessibility Guidelines. |
set-cookie | Creates a cookie with specified name,expires date and value.
Example: <meta http-equiv="set-cookie" content="w3scookie=myContent;expires=Fri, 30 Dec 2011 12:00:00 GMT; path=http://www.w3schools.com"> |
window-target | Specifies the name of the frame where the current document must be loaded |