自强学堂
自强学堂:学习、分享、让你更强!
JavaScript 参考手册HTMLCSSJAVASCRIPTJQUERYSQLPHPBOOTSTRAPANGULARXML
 

HTML DOM Meta name 属性

Meta 对象参考手册 Meta 对象

定义和用法

name 属性可设置或者返回content属性信息名称。

name 属性值依赖 content 属性值。

Name属性可以预定义值,或由用户定义。/p>

语法

设置 name 属性:

linkObject.name="name"

返回 name 属性:

linkObject.name

预定义 name 值:

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

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

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

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

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

doc-classSpecifies completion status of the document
doc-rightsSpecifies copyright status of the document
doc-typeSpecifies the type of the document
DownloadOptionsThe associated content property determines what buttons are visible on the File Download dialog box
expiresSpecifies the date and time when the page expires.

实例:
<meta name="expires" content="Fri, 10 Jun 2011 12:00:00 GMT">
generatorSpecifies the name of the program that generated the document
googlebotInforms the Google search engine about indexing, archiving and link-following rules.
  • noarchive - Prevent Google search engine from archiving the page
  • nofollow - The page can be indexed, but links should not be followed
  • noindex - Google robots should follow links, but not index the page
  • nosnippet - Prevent Google search engine from saving snippets and archiving the document

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

keywordsInforms search engines what your site is about.

Tip: Always specify keywords (needed by search engines to catalogize the page).

实例:
<meta http-equiv="keywords" content="HTML, HTML DOM, JavaScript">
MSSmartTagsPreventParsingPrevents any Microsoft product from automatically generating smart tags
nameSpecifies the name of the document
ownerDefines the owner of the page or site
progidDefines the id of a program used to generate the document
ratingDefines webpage rating
refreshThe document will display for a specified amount of time before refreshing or switch to a new URL.

实例:
<meta name="refresh" content="10">
<meta name="refresh" content="10;URL=http://www.ziqiangxuetang.com">
reply-toDefines an email address of a contact for the document
resource-typeDefines the type of web resource
revisit-afterDefines how often search engine spiders should revisit the site
robotsDefines page indexing mechanisms for robots, search engine indexing and link-following rules.

The content attribute should contain a comma separated list of the following values:
  • ALL - Robots should follow links, index and archive this page
  • FOLLOW - Search engine robots should follow links from this page
  • INDEX - Robots should include and index this page
  • NOARCHIVE - Prevent search engines from archiving the page
  • NOINDEX - Robots should follow links, but should not index the page
  • NOFOLLOW - The page can be indexed, but links should not be followed
  • NONE - Search engine robots can ignore the page

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

TemplateThe content attribute should specify the location of the template used to edit the document
othersYou can define your own names in a schema


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 name 属性


实例

实例

显示 <meta> 标签 name 属性的值:

<html>
<head>
<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>

尝试一下 »


Meta 对象参考手册 Meta 对象