Latest web development tutorials

HTML DOM Meta name attribute

Meta Object Reference Meta Object

Definition and Usage

name property sets or returns the name of the attribute information content.

name attribute value depends on the content attribute values.

Name property value can be predefined or user-defined. / P>

grammar

Setting name attribute:

linkObject.name="name"

Returns the name attribute:

linkObject.name

Predefinednamevalue:

描述
abstract 定义了一个二级描述
author 定义文档的作者。

实例:
<meta name="author" content="Hege Refsnes">
classification 归类站点到正确类别
copyright 定义文档的版权信息。

实例:
<meta name="copyright" content="2011© W3Cschool.cc">
description 索引擎可以使用这个描述作为搜索结果。

实例:
<meta name="description" content="Free web tutorials">
distribution 规定文件是否可用于Web或Intranet。
  • web - 互联网
  • intranet - 内网

实例:
<meta name="distribution" content="web">

doc-class 指定文档完成的状态
doc-rights 文档的版权声明
doc-type 指定文档的类型
DownloadOptions 控制下载对话框按钮的显示。noopen - 隐藏打开按钮,nosave - 隐藏保存按钮。
expires 设置网页过期时间

实例:
<meta name="expires" content="Fri, 10 Jun 2011 12:00:00 GMT">
generator 指定文档生成的工具名称
googlebot 设置 Google 搜索隐藏的收入规则:
  • noarchive - 告诉爬虫,不要为本网页建立快照
  • nofollow - 网页可以被追踪,但网页的链接不要去追终
  • noindex - 链接可以被追踪,但含此标签的网页不能建立索引
  • nosnippet - 告诉Google不要在搜索结果页的列表里显示含此标签的网站的描述语句,并且不要在列表里显示快照链接。

实例:
<meta http-equiv="googlebot" content="noarchive">

keywords 网页关键字

提示:一般需要指定该标签,有利于搜索引擎的优化。

实例:
<meta http-equiv="keywords" content="HTML, HTML DOM, JavaScript">
MSSmartTagsPreventParsing 防止微软页面编辑软件在页面上自动添加标签、链接等。
name 指定文档的名称
owner 定义网页的所有者
progid 定义程序 id 用于生成文档。
rating 定义内容分级,如:14 years(14岁以上),general(普通人),mature(成年人),restricted(限制级),safe for kids(孩童)。
refresh 定义文档在规定的时间内容刷新或跳转到新的 URL 上。

实例:
<meta name="refresh" content="10">
<meta name="refresh" content="10;URL=http://www.w3big.com">
reply-to 定义网页开发者的邮件地址
resource-type 定义 web 资源类型
revisit-after 定义搜索引擎爬取网页的时间频率
robots 设定搜索引擎爬取网页的规则:

可以是以下属性,多个属性使用逗号隔开:
  • ALL - 容将被检索,且页面上的链接可以被追踪
  • FOLLOW - 页面上的链接可以被追踪
  • INDEX - 网页可以被索引
  • NOARCHIVE - 告诉爬虫,不要为本网页建立快照
  • NOINDEX - 链接可以被追踪,但含此标签的网页不能建立索引
  • NOFOLLOW - 网页可以被追踪,但网页的链接不要去追终
  • NONE - 搜索引擎可以忽略该网页

实例:
<meta name="robots" content="ALL">
<meta name="robots" content="INDEX,NOFOLLOW">

Template 内容属性可以指定用于编译文档的模板位置
others 你可以定义自己的名字


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support attribute name


Examples

Examples

Display <meta> tag name attribute values:

<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Meta name = "keywords" content = "HTML, HTML DOM, JavaScript">
<Script>
function displayResult () {
var x = document.getElementsByTagName ( "meta") [0] .name;
alert (x);
}
</ Script>
</ Head>
<Body>

<Button type = "button" onclick = "displayResult ()"> Display meta name </ button>

</ Body>
</ Html>

try it"


Meta Object Reference Meta Object