屬性 |
#值 |
##描述
|
#http-equiv
|
#content-type / expire / refresh / set-cookie
|
把content屬性關聯到HTTP頭。
|
name
|
#author / description / keywords / generator / revised / others
| #把content 屬性關聯到一個名稱。
|
content
|
#some text
|
定義用於翻譯content屬性值的格式。
|
#SEO優化
參考文件
<span style="font-size: 14px;"><meta name="keywords" content="your tags"></span>
<span style="font-size: 14px;"><meta name="description" content="150 words"></span>
<span style="font-size: 14px;"><meta name="robots" content="index,follow">
<!--<br/> all:文件将被检索,且页面上的链接可以被查询;<br/> none:文件将不被检索,且页面上的链接不可以被查询;<br/> index:文件将被检索;<br/> follow:页面上的链接可以被查询;<br/> noindex:文件将不被检索;<br/> nofollow:页面上的链接不可以被查询。<br/> --></span>
<span style="font-size: 14px;"><pre class="brush:html;toolbar:false"><meta http-equiv="refresh" content="0;url=">
<span style="font-size: 14px;"><meta name="author" content="author name"> <!-- 定义网页作者 --><meta name="google" content="index,follow">
<meta name="googlebot" content="index,follow">
<meta name="verify" content="index,follow"></span>
#行動裝置
<span style="font-size: 14px;"><meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no">
<!-- `width=device-width` 会导致 iPhone 5 添加到主屏后以 WebApp 全屏模式打开页面时出现黑边 --></span>
width:寬度(數值/ device-width)(範圍從200 到10,000,預設為980 像素)
height:高度(數值/ device-height)(範圍從223 到10,000)
-
initial-scale:初始的縮放比例(範圍從>0 到10)
#
minimum-scale:允许用户缩放到的最小比例
maximum-scale:允许用户缩放到的最大比例
user-scalable:用户是否可以手动缩 (no,yes)
minimal-ui:可以在页面加载时最小化上下状态栏。(已弃用)
注意,很多人使用initial-scale=1到非响应式网站上,这会让网站以100%宽度渲染,用户需要手动移动页面或者缩放。如果和initial-scale=1同时使用user-scalable=no或maximum-scale=1,则用户将不能放大/缩小网页来看到全部的内容。
<span style="font-size: 14px;"><meta name="apple-mobile-web-app-capable" content="yes"> <!-- 启用 WebApp 全屏模式 --></span>
<span style="font-size: 14px;"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"></span>
<span style="font-size: 14px;"><meta name="apple-mobile-web-app-title" content="标题"></span>
<span style="font-size: 14px;"><meta content="telephone=no" name="format-detection"> </span>
<span style="font-size: 14px;"><meta content="email=no" name="format-detection"></span>
<span style="font-size: 14px;"><meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL"> </span>
<span style="font-size: 14px;"><!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑莓 --><meta name="HandheldFriendly" content="true">
<!-- 微软的老式浏览器 --><meta name="MobileOptimized" content="320">
<!-- uc强制竖屏 --><meta name="screen-orientation" content="portrait">
<!-- QQ强制竖屏 --><meta name="x5-orientation" content="portrait">
<!-- UC强制全屏 --><meta name="full-screen" content="yes">
<!-- QQ强制全屏 --><meta name="x5-fullscreen" content="true">
<!-- UC应用模式 --><meta name="browsermode" content="application">
<!-- QQ应用模式 --><meta name="x5-page-mode" content="app">
<!-- windows phone 点击无高光 --><meta name="msapplication-tap-highlight" content="no"></span>
网页相关
<span style="font-size: 14px;"><meta charset="'utf-8'"></span>
<span style="font-size: 14px;"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!-- 关于X-UA-Compatible --><meta http-equiv="X-UA-Compatible" content="IE=6">
<!-- 使用IE6 --><meta http-equiv="X-UA-Compatible" content="IE=7">
<!-- 使用IE7 --><meta http-equiv="X-UA-Compatible" content="IE=8">
<!-- 使用IE8 --></span>
<span style="font-size: 14px;"> <meta name="renderer" content="webkit|ie-comp|ie-stand"></span>
国内双核浏览器默认内核模式如下:
1. 搜狗高速浏览器、QQ浏览器:IE内核(兼容模式)
2. 360极速浏览器、遨游浏览器:Webkit内核(极速模式)
<span style="font-size: 14px;"><meta http-equiv="Pragma" content="no-cache"></span>
<span style="font-size: 14px;"><meta name="msapplication-TileColor" content="#000"> <!-- Windows 8 磁贴颜色 --><meta name="msapplication-TileImage" content="icon.png"> <!-- Windows 8 磁贴图标 --></span>
<span style="font-size: 14px;"><meta name="mobile-agent" content="format=[wml|xhtml|html5]; url=url">
<!--<br/>[wml|xhtml|html5]根据手机页的协议语言,选择其中一种;<br/>url="url" 后者代表当前PC页所对应的手机页URL,两者必须是一一对应关系。<br/> --></span>
<span style="font-size: 14px;"><meta http-equiv="Cache-Control" content="no-siteapp"></span>
相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
推荐阅读:
H5+Canvas使用案例详解
怎样使用javascript Date Format方法