You are here: Reference > JavaScript > client-side > HTML DOM > properties > httpEquiv (meta)

httpEquiv property (meta)

Browser support:
Sets or retrieves information for HTTP response message headers. Use it with the content property to create a well-defined meta tag.

Syntax:

object.httpEquiv;
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: http-Equiv

Possible values:

String that sets or retrieves information about the HTTP response message header.
The list below contains only the commonly used values, for a detailed list, please visit the Header Field Definitions (W3C) site.
cache-control
Controls the caching mechanism to use for the page.
Available values:
Public - cached in public shared caches
Private - cached in private cache
no-Cache - not cached
no-Store - cached but not archived
<meta http-equiv="cache-control" content="NO-CACHE" />
content-language
Specifies the primary natural language(s) of the document. Used by search engines to categorize pages by language.
<meta http-equiv="content-language" content="en-US,de" />
content-type
Specifies the character set for the contents of page. It is recommended to always specify the character set. Use the charset property instead in HTML5.
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
date
Specifies the date and time when the page was created.
<meta http-equiv="date" content="Thu, 18 Nov 2008 19:11:42 GMT" />
expires
Specifies the date and time when the page will expire.
<meta http-equiv="expires" content="Wed, 9 Nov 2011 12:00:00 GMT" />
last-modified
Specifies the last modification date.
<meta http-equiv="last-modified" content="Thu, 18 Nov 2008 19:11:42 GMT" />
location
Redirects the recipient to another location.
<meta http-equiv="location" content="URL=http://www.dottoro.com" />
page-enter
Specifies the Internet Explorer filter transition effect that is to be performed when the site is loaded.
<meta http-equiv="page-enter" content="revealtrans(duration=seconds,transition=num)" />
page-exit
Specifies the Internet Explorer filter transition effect that is to be performed when the site is loaded.
<meta http-equiv="page-exit" content="revealtrans(duration=seconds,transition=num)" />
pics-label
Specifies information to content loaders.
pragma
Specifies cache control for older browsers. Same as cache-control.
set-cookie
Creates a cookie with specified name,expires date and value. More than one cookie should be created by meta tags.
<meta http-equiv="set-cookie" content="name=value; expires=date; path=url" /> <meta http-equiv="set-cookie" content="dottocookie=myContent;expires=Wed, 9 Nov 2011 12:00:00 GMT; path=http://www.dottoro.com">
site-enter
Specifies the Internet Explorer filter transition effect that is to be performed when the site is loaded.
<meta http-equiv="site-enter" content="revealtrans(duration=seconds,transition=num)" />
site-exit
Specifies the Internet Explorer filter transition effect that is to be performed when the site is loaded.
<meta http-equiv="site-enter" content="revealtrans(duration=seconds,transition=num)" />
window-target
Specifies the name of the frame where the current document must be loaded.
x-ua-compatible
8
Specifies the Document Compatibility Mode in Internet Explorer from version 8. For further details, please see Defining Document Compatibility (MSDN).
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the http-Equiv attribute:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Refresh" content="20" />
    <meta http-equiv="Expires" content="Tue, 20 Aug 2020 14:25:27 GMT" />
</head>
<body >
</body>
</html>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the http-Equiv property:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Refresh" content="2" />
    <meta http-equiv="Expires" content="Tue, 20 Aug 2020 14:25:27 GMT" />
    <script type="text/javascript">
        function GetHttpEquiv () {
            var metaTags = document.getElementsByTagName ("meta");

            for (var i = 0; i < metaTags.length; i++) {
                alert ("The value of the http-equiv property in the " + (i+1) + ". meta tag: " +metaTags[i].httpEquiv);
            }
        }
    </script>
</head>
<body >
    <button onclick="GetHttpEquiv ();">Get HTTP-EQUIV!</button>
</body>
</html>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content