Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Meta name Property

Meta name Property

Meta Object Reference Meta Object


Definition and Usage

The name property sets or returns the name of the information in a meta element.

The name property value depends on the value of the content property.

The name property can be a predefined value or user-defined.

Syntax

Set the name attribute:



metaObject.name = "application-name|author|description|generator|keywords"

Return the name attribute:

metaObject.name

Value Description
application-name Specify the web application name
author

Defines the author of the document.

Example:

description

Specifies the page description. Search engines can use this description as a search result.

Example:

generator

Specifies the name of the tool that generated the document.

Example:

keywords

Specifies the web page keywords - used to tell search engines the keywords related to the web page content.

Example:


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the name property.


Return Value

Type Description
String name property values

Example

Example

Display The value of the name attribute of the tag:

var

x

=

document

.

getElementsByTagName

(

"

META

"

)

;

var

txt

=

"

"

;

var

i

;

for

(

i

=

0

;

i

<

x

.

length

;

i

++

)

{

txt

=

txt

"

Name of

"

(

i

1

)

"

. meta tag:

"

x

[

i

]

.

name

"


"

;

}

Try it »


Meta Object Reference Meta Object