HTML DOM Meta httpEquiv Property

## JavaScript Reference

Overview

## JavaScript Objects

JS Array JS Boolean JS Date JS Math JS Number JS String JS RegExp JS Global

## Browser Objects

Window Navigator Screen History Location

## HTML DOM Objects

DOM Document DOM Elements DOM Attributes DOM Events

## HTML Objects

DOM Anchor DOM Area DOM Base DOM Body DOM Button DOM Form DOM Frame/IFrame DOM Frameset DOM Image DOM Input Button DOM Input Checkbox DOM Input File DOM Input Hidden DOM Input Password DOM Input Radio DOM Input Reset DOM Input Submit DOM Input Text DOM Link DOM Meta DOM Object DOM Option DOM Select DOM Style DOM Table DOM td / th DOM tr DOM Textarea

# Meta httpEquiv Property

Meta Object

## Definition and Usage

The httpEquiv property sets or returns an HTTP header for the information in the content attribute.

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

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

Note: If the name attribute is set, the http-equiv attribute should not be set.

## Syntax

Set the httpEquiv property:

linkObject.httpEquiv="HTTP-header"

Return the httpEquiv property:

linkObject.httpEquiv

Some commonly used HTTP-header values are:

Value | Description
--- | ---

cache-control

Controls the caching mechanism to use for the document.

Available values:

- public - cached in public shared caches
- private - cached in private cache
- no-cache - not cached
- no-store - cached but not archived

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">
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

## Browser Support

The httpEquiv property is supported in all major browsers.

## Example

Display the HTTP header for the information in the content attribute:

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
function displayResult()
{
var x=document.getElementsByTagName("meta")[0].httpEquiv;
alert(x);
}
</script>
</head>
<body>
<button type="button" onclick="displayResult()">Display HTTP-Equiv</button>
</body>
</html>
Try it yourself »

Meta Object

## Your suggestion:

Your E-mail (optional):

Page address:

Description:

Close [X]

## Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

## WEB HOSTING

Best Web Hosting UK Reseller Hosting Wow! $5 SSD Hosting

## WEB BUILDING

Download XML Editor
FREE Website BUILDER FREE Website Creator

## WEB RESOURCES

Web Statistics Web Validation

## SHARE THIS PAGE