Meta nazwa Właściwość
Przykład
Zwróć wartość atrybutu content wszystkich elementów meta:
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>";
}
Definicja i użycie
Właściwość name ustawia lub zwraca nazwę informacji w atrybucie content.
Wartość atrybutu name zależy od wartości atrybutu content.
Istnieje również rozszerzona lista zdefiniowana na stronie WHATWG Wiki MetaExtensions — każdy może w dowolnym momencie edytować stronę, aby dodać nowy typ. Żadne nie są formalnie akceptowane, ale mogą być w przyszłości. Aby uzyskać więcej informacji, odwiedź stronę WHATWG Wiki MetaExtensions .
Uwaga: Jeśli ustawiony jest atrybut http-equiv, nie należy ustawiać atrybutu nazwy.
Obsługa przeglądarki
Property | |||||
---|---|---|---|---|---|
name | Yes | Yes | Yes | Yes | Yes |
Składnia
Zwróć właściwość nazwy:
metaObject.name
Ustaw właściwość nazwy:
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"> |
Wartość zwrotu
Type | Description |
---|---|
String | A name for the information in the content attribute |
❮ Meta obiekt