メタ名プロパティ
例
すべてのメタ要素のcontent属性の値を返します。
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>";
}
定義と使用法
nameプロパティは、content属性の情報の名前を設定または返します。
name属性の値は、content属性の値によって異なります。
WHATWG Wiki MetaExtensionsページで定義された拡張リストもあります-誰でもいつでもページを編集して、新しいタイプを追加できます。正式に受け入れられるものはありませんが、将来的に受け入れられる可能性があります。詳細については、 WHATWG WikiMetaExtensionsページにアクセスしてください。
注: http-equiv属性が設定されている場合は、name属性を設定しないでください。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
name | Yes | Yes | Yes | Yes | Yes |
構文
nameプロパティを返します。
metaObject.name
nameプロパティを設定します。
metaObject.name = "application-name|author|description|generator|keywords"
Value | Description |
---|---|
application-name | Specifies the name of the Web application that the page represents |
author | Specifies the name of the author of the document. Example: <meta name="author" content="Hege Refsnes"> |
description | Specifies a description of the page. Search engines can pick up this description to show with the results of searches. Example: <meta name="description" content="Free web tutorials"> |
generator | Specifies one of the software packages used to generate the document (not used on hand-authored pages) Example: <meta name="generator" content="FrontPage 4.0"> |
keywords | Specifies a comma-separated list of keywords - relevant to the page (Informs search engines what the page is about). Tip: Always specify keywords (needed by search engines to catalogize the page). Example: <meta name="keywords" content="HTML, meta tag, tag reference"> |
戻り値
Type | Description |
---|---|
String | A name for the information in the content attribute |
❮メタオブジェクト