Meta name attribute
Definition and Usage
name
Sets or returns the name of the information in the HTML <meta> content attribute.
<meta> name attribute value depends on HTML <meta> content Attribute value.
The WHATWG Wiki MetaExtensions page also defines a list of extensions - anyone can freely edit the page at any time to add new types. None of them have been officially accepted, but they may be in the future. For more information, please visit the WHATWG Wiki MetaExtensions page.
Note:If set http-equiv attributeIf set, the name attribute should not be set.
See also:
HTML Reference Manual:HTML <meta> Tag
Example
Return the content attribute values of all meta elements:
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>"; }
Syntax
Return the name attribute:
metaObject.name
Set the name attribute:
metaObject.name = "application-name|author|description|generator|keywords"
Attribute value
Value | Description |
---|---|
application-name | Specify the name of the Web application represented by the page. |
author |
Specify the name of the document author. Example: <meta name="author" content="Hege Refsnes"> |
description |
Specify the description of the page. Search engines can choose this description to display search results. Example: <meta name="description" content="Free web tutorials"> |
generator |
Specify the software package used to generate the document (not used for hand-written pages). Example: <meta name="generator" content="FrontPage 4.0"> |
keywords |
Specify a comma-separated list of keywords related to the page (inform the search engine of the content of this page). Tip:Always specify keywords (search engines need to classify pages). Example: <meta name="keywords" content="HTML, meta tag, tag reference manual"> |
Technical Details
Return Value: | String, the name of the information in the content attribute. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Related Pages
HTML Reference Manual:HTML <meta> name Attribute