HTML DOM Meta httpEquiv Property
\n\n \n\n\n\n
Definition and Usage
\n\nThe httpEquiv property can set or return the HTTP header information in the content attribute.
\n\nThe http-equiv attribute can be used to simulate HTTP response header information.
\n\nThe value of the http-equiv attribute depends on the value of the content attribute.
\n\nNote: If the name attribute is set, the http-equiv attribute does not need to be set.
\n\nSyntax
\n\nSet the httpEquiv property:
\nlinkObject.httpEquiv="_HTTP-header_"\n\n Return the httpEquiv property:
\nlinkObject.httpEquiv\n\n Some commonly used _HTTP-header_ values:
\n| Value | \nDescription | \n
|---|---|
| cache-control | \nControl 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"> | \n
| content-language | \nLanguage of the response body Example: <meta http-equiv="content-language" content="en-US"> | \n
| content-type | \nReturns 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"> | \n
| date | \nTime when the origin server sent the message Example: <meta http-equiv="date" content="Wed, 16 Feb 2011 22:34:13 GMT"> | \n
| expires | \nDate and time when the response expires Example: <meta http-equiv="expires" content="Fri, 30 Dec 2011 12:00:00 GMT"> | \n
| last-modified | \nLast modified time of the requested resource Example: <meta http-equiv="last-modified" content="Mon, 03 Jan 2011 17:45:57 GMT"> | \n
| location | \nUsed 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="> | \n
| refresh | \nDefines how often the page is refreshed Example: <meta http-equiv="refresh" content="300"> | \n
| set-cookie | \nCreates 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="> | \n
| window-target | \nSpecifies the name of the frame to be loaded | \n
\n\n
Browser Support
\n\n
All major browsers support the httpEquiv property
\n\n\n\n
Examples
\n\nExample
\n\nDisplay 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 \n\n \n\n
YouTip