YouTip LogoYouTip

Prop Meta Httpequiv

HTML DOM Meta httpEquiv Property\n\n

HTML DOM Meta httpEquiv Property

\n\n

Image 1: Meta Object Reference Manual Meta Object

\n\n
\n\n

Definition and Usage

\n\n

The httpEquiv property can set or return the HTTP header information in the content attribute.

\n\n

The http-equiv attribute can be used to simulate HTTP response header information.

\n\n

The value of the http-equiv attribute depends on the value of the content attribute.

\n\n

Note: If the name attribute is set, the http-equiv attribute does not need to be set.

\n\n

Syntax

\n\n

Set the httpEquiv property:

\n
linkObject.httpEquiv="_HTTP-header_"
\n\n

Return the httpEquiv property:

\n
linkObject.httpEquiv
\n\n

Some commonly used _HTTP-header_ values:

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
ValueDescription
cache-controlControl the document's caching mechanism. Allowed values: * public - all content will be cached (client and proxy servers can cache) * private - content is cached only in private cache (only client can cache, proxy servers cannot) * no-cache - do not cache * no-store - do not cache when not archived Example: <meta http-equiv="cache-control" content="no-cache">
content-languageLanguage of the response body Example: <meta http-equiv="content-language" content="en-US">
content-typeReturns the MIME type of the content Tip: Usually used for character set setting. Example: <meta http-equiv="content-type" content="text/html; charset=UTF-8">
dateTime when the origin server sent the message Example: <meta http-equiv="date" content="Wed, 16 Feb 2011 22:34:13 GMT">
expiresDate and time when the response expires Example: <meta http-equiv="expires" content="Fri, 30 Dec 2011 12:00:00 GMT">
last-modifiedLast modified time of the requested resource Example: <meta http-equiv="last-modified" content="Mon, 03 Jan 2011 17:45:57 GMT">
locationUsed to redirect the recipient to a non-requested URL location to fulfill the request or identify a new resource Example: <meta http-equiv="location" content="URL=">
refreshDefines how often the page is refreshed Example: <meta http-equiv="refresh" content="300">
set-cookieCreates a cookie, including cookie name, cookie value, expiration time. Example: <meta http-equiv="set-cookie" content="sitecookie=myContent;expires=Fri, 30 Dec 2015 12:00:00 GMT; path=">
window-targetSpecifies the name of the frame to be loaded
\n\n
\n\n

Browser Support

\n\n

Internet Explorer Firefox Opera Google Chrome Safari

\n\n

All major browsers support the httpEquiv property

\n\n
\n\n

Examples

\n\n

Example

\n\n

Display HTTP header information:

\n\n
<!DOCTYPE html>\n\n<html>\n\n<head>\n\n<meta charset="utf-8">\n\n<title>()</title>\n\n<meta http-equiv="content-type" content="text/html;charset=utf-8">\n\n<script>\n\n function displayResult(){ \n\nvar x=document.getElementsByTagName("meta").httpEquiv; \n\nalert(x); \n\n }\n\n</script>\n\n</head>\n\n<body>\n\n<button type="button" onclick="displayResult()">Display HTTP-Equiv</button>\n\n</body>\n\n</html>
\n\n

Try it yourself Β»

\n\n
\n\n

Image 7: Meta Object Reference Manual Meta Object

← Prop Meta NameProp Link Href β†’