代码改变世界

常用<meta>标签

2016-08-23 10:16  路途遥远,Go~  阅读(279)  评论(0编辑  收藏  举报
页面关键词
  <meta name="keywords" content="your tags" />

  页面描述
  <meta name="description" content="150 words" />

  搜索引擎索引方式
  <meta name="robots" content="index,follow" />
  <!--
  all:文件将被检索,且页面上的链接可以被查询;
  none:文件将不被检索,且页面上的链接不可以被查询;
  index:文件将被检索;
  follow:页面上的链接可以被查询;
  noindex:文件将不被检索;
  nofollow:页面上的链接不可以被查询。
  -->

  页面重定向和刷新
  <meta http-equiv="refresh" content="0;url=" />

  其他
  <meta name="author" content="author name" /> <!-- 定义网页作者 -->
  <meta name="google" content="index,follow" />
  <meta name="googlebot" content="index,follow" />
  <meta name="verify" content="index,follow" />

  移动设备
  <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
  <!-- `width=device-width` 会导致 iPhone 5 添加到主屏后以 WebApp 全屏模式打开页面时出现黑边 -->

  WebApp全屏模式
  <meta name="apple-mobile-web-app-capable" content="yes" /> <!-- 启用 WebApp 全屏模式 -->

  隐藏状态栏/设置状态栏颜色
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

  添加到主屏后的标题
  <meta name="apple-mobile-web-app-title" content="标题">

  忽略数字自动识别为电话号码
  <meta content="telephone=no" name="format-detection" />

  忽略识别邮箱
  <meta content="email=no" name="format-detection" />

  申明编码
  <meta charset='utf-8' />

  优先使用 IE 最新版本和 Chrome
  <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 -->

  禁止浏览器从本地计算机的缓存中访问页面内容
  <meta http-equiv="Pragma" content="no-cache">

在iPhone的浏览器中页面将以原始大小显示,不允许缩放。  

<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">   

 

width - viewport的宽度 height - viewport的高度   

initial-scale - 初始的缩放比例  

minimum-scale - 允许用户缩放到的最小比例   

maximum-scale - 允许用户缩放到的最大比例  

user-scalable - 用户是否可以手动缩放  

 

----------------------------------------------------------------------------------------------------------------------------------------------

在iPhone 手机上默认值是(电话号码显示为拨号的超链接):

<meta name="format-detection" content="telephone=yes"/>

可将telephone=no,则手机号码不被显示为拨号链接

<meta name="format-detection" content="telephone=no"/>

------------------------------------------------------------------------------------------------------------------

 

ios设备对meta定义的私有属性:(可以添加至主屏幕)
<meta name="apple-mobile-web-app-capable" content="yes" />

•网站开启对web app程序的支持。
<meta name="apple-mobile-web-app-status-bar-style" content="black" />

•在web app应用下状态条(屏幕顶部条)的颜色;
•默认值为default(白色),可以定为black(黑色)和black-translucent(灰色半透明)。

•若值为“black-translucent”将会占据页面px位置,浮在页面上方(会覆盖页面20px高度–iphone4和itouch4的Retina屏幕为40px)。