Метаимя Свойство _
Пример
Вернуть значение атрибута содержимого всех метаэлементов:
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 задает или возвращает имя для информации в атрибуте содержимого.
Значение атрибута имени зависит от значения атрибута содержимого.
Существует также расширенный список, определенный на странице метарасширений WHATWG Wiki — любой может в любое время отредактировать страницу, чтобы добавить новый тип. Ни один из них официально не принят, но может быть принят в будущем. Для получения дополнительной информации посетите страницу WHATWG Wiki MetaExtensions .
Примечание. Если установлен атрибут http-equiv, атрибут name устанавливать не следует.
Поддержка браузера
Property | |||||
---|---|---|---|---|---|
name | Yes | Yes | Yes | Yes | Yes |
Синтаксис
Вернуть свойство имени:
metaObject.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 |
❮ Метаобъект