You are here: Reference > JavaScript > client-side > HTML DOM > objects > nodes and tags > meta

meta object

Browser support:
Specifies general information about the document.
The meta element can be used to specify the character set and content-type of your page, keywords for search engines and other information about your document.
The meta element must be placed in the head section before the body element.
The next table contains only the most commonly used meta tags, for a complete list of available meta definitions, please see the page for the http-equiv or name properties.
meta type Description
author Records the name of the author of the document.
<meta name="author" content="dottoro.com" />
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" />
charset Specifies the character set for the page content in HTML5. It is recommended to always specify the character set. In document types other than HTML5, use the 'content-type' meta tag instead. For a list of character sets, please see the page for the character sets.
<meta charset="UTF-8" />
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 page content. It is recommended to always specify the character set. In HTML5, use the charset property instead. For a list of character sets, please see the page for the character sets.
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
copyright Used to include copyright information into the document.
<meta name="copyright" content="© 2009 Dottoro.com" />
date Specifies the date and time when the page was created.
<meta http-equiv="date" content="Thu, 18 Nov 2008 19:11:42 GMT" />
description Some search engines pick up this description to show with the results of searches.
<meta name="description" content="...Help page for the meta tag..." />
expires Specifies the date and time when the page will expire.
<meta http-equiv="expires" content="Wed, 9 Nov 2011 12:00:00 GMT" />
googlebot This is an addition to the robots META Command, it informs only the Google search engine about indexing, archiving and link following rules.
<meta name="googlebot" content="noarchive" />
keywords Inform search engines what your web site or page is about. It is recommended to always specify this type of meta, because it is necessary for search engines to catalogize the page.
<meta name="keywords" content="help, html help, JavaScript help, CSS help, manual ..." />
last-modified Specifies the last modification date.
<meta http-equiv="last-modified" content="Thu, 18 Nov 2008 19:11:42 GMT" />
refresh Indicates the document displays for a specified amount of time before switching to a new URL or refreshes the current. Useful to redirecting browsers to other pages, or to refresh the current page (news page).
<meta name="refresh" content="15" /> <meta name="refresh" content="15;URL=http://www.dottoro.com" />
robots Defines pages robot indexing mechanism, search engines indexing and link following rules.
The content property should have a comma separated list of the following values:
ALL - Robots should follow links, index and archive this page.
FOLLOW - Search engine robots should follow links from this page.
INDEX - Robots should include and index this page.
NOARCHIVE - Prevent search engines from archiving the page
NOINDEX - Robots should follow links, but should not index the page.
NOFOLLOW - The page can be indexed, but links should not be followed.
NONE - Search engine robots can ignore the page.
<meta name="robots" content="ALL" /> <meta name="robots" content="INDEX,NOFOLLOW" />

Syntax:

Methods that return the object:
document.createElement ("meta")
The base interface, through which you can add new functionalities to the meta object, is the HTMLMetaElement interface.
If you want to see the HTML objects by categories, please visit this page.
HTML page for this element: meta

Possible members:

Properties
Methods
Events
Style properties
attributes
Represents a collection of attribute nodes that belong to an element.
baseURI
10
Returns the base URL for the object.
behaviorUrns
Represents a collection of the Uniform Resource Names for all behaviors attached to an element.
canHaveChildren
Retrieves a Boolean value that indicates whether the element can contain child elements.
canHaveHTML
Retrieves a Boolean value that indicates whether the element can contain HTML formatted text.
charset
Sets or retrieves the character encoding of the document, a linked document or a script block.
content
Sets or returns the meta information itself.
currentStyle
Represents the computed style settings for an element.
dir
Sets or retrieves the text direction as related to the lang property.
httpEquiv
Sets or retrieves information for HTTP response message headers. Use it with the content property to create a well-defined meta tag.
id
Sets or retrieves a unique identifier for the object.
isContentEditable
Returns a Boolean value that indicates whether the contents of the object are editable by the user.
isDisabled
Returns a Boolean value that indicates whether the object is disabled.
isMultiLine
Returns a Boolean value that indicates whether the contents of an element can be multiline or not.
isTextEdit
Returns a Boolean value that indicates whether the createTextRange method can be used for the element.
lang
Specifies or returns the language of the element.
localName
9
Returns the local part of the qualified name of the current node.
name
Sets or retrieves the name given to the meta information. Use it with the content property attribute to create a well-defined meta tag.
namespaceURI
93.6
Sets or returns the namespace URI of the current node.
nextElementSibling
93.5
Returns a reference to the next child element of the current element's parent.
nextSibling
Returns a reference to the next child of the current element's parent.
nodeName
Returns the name of the current node.
nodeType
Returns an integer that indicates the type of the node.
nodeValue
Sets or returns the value of the current node.
outerHTML
Sets or retrieves the outer HTML content (the source code including the opening and closing tags) of an element.
outerText
Sets or returns the text content of an element including the text content of its descendants.
ownerDocument
Returns the document object that contains the current node.
parentElement
Returns the parent element of the object in the DOM hierarchy.
parentNode
Returns the parent element of the current node in the DOM hierarchy.
parentTextEdit
Returns the closest ancestor element of the current element in the DOM hierarchy that can be used to create a TextRange object.
previousElementSibling
93.5
Returns a reference to the previous child element of the current element's parent.
previousSibling
Returns a reference to the previous node of the current element's parent.
readyState
Returns a string value that represents the state of the object.
runtimeStyle
Represents the overridden style settings for an element.
scheme
Specifies or returns how the value of content should be interpreted, when name is used.
scopeName
Retrieves the local name of the namespace declared for the current element.
sourceIndex
Returns the position of the current object in the all collection of the document.
style
Represents the inline style settings for an element or a CSS rule.
tagName
Returns the tag name of the current element.
tagUrn
Sets or retrieves the Uniform Resource Name (URN) of the namespace declared for the current element.
uniqueID
Returns the unique identifier generated by the browser for the object.

Example HTML code 1:

This example shows how to set the character encoding of the document in HTML5:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
</head>
<body>
</body>
</html>
Did you find this example helpful? yes no

Example HTML code 2:

This example shows how to set the character encoding of the document in document types other than HTML5:
<!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" />
</head>
<body>
</body>
</html>
Did you find this example helpful? yes no

Example HTML code 3:

This example illustrates the use of meta elements:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="Expires" content="Tue, 20 Aug 2020 14:25:27 GMT" />
    <meta name="Author" content="Dave Raggett" />
</head>
<body>
</body>
</html>
Did you find this example helpful? yes no

Related pages:

External links:

User Contributed Comments
    <!-- for choose language in head tag-->
<meta http-equiv="Content-Language" content="en-us" />

    <!-- for refresh page or go to another url by after choosed second -->
<meta name="refresh" content="4; url=http://www.yoursite.com" />

    <!-- for show this page in some search engines -->
<meta name="description" content=" your text here " />

    <!-- for show this page in all search engines -->
<meta name="keywords" content=" word1,word2,word3,.... " />

    <!-- for your copy right in page -->
<meta name="copyright" content="© 2010 Dilovan" />

Post Content

Post Content