Meta nameAttribute
Meta Object
Definition and Usage
The name attribute can set or return the name of the content attribute information.
The name attribute value depends on the content attribute value.
The name attribute 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 | Specifies the name of the web application |
| author | Defines the author of the document. Example: <meta name="author" content="Example"> |
| description | Specifies the page description. Search engines can use this description as the search result. Example: <meta name="description" content="免费编程入门教程"> |
| generator | Specifies the name of the tool that generated the document. Example: <meta name="generator" content="FrontPage 4.0"> |
| keywords | Specifies the keywords for the webpage - used to tell search engines the relevant keywords for the webpage content. Example: <meta name="keywords" content="HTML, HTML DOM, JavaScript"> |
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the name attribute
Return Value
| Type | Description |
|---|---|
| String | name attribute value |
Example
Example
Display the value of the <meta> tag's name attribute:
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+"<br>";
}
Try it Yourself »
Meta Object Other Extensions