码迷,mamicode.com
首页 > 移动开发 > 详细

webapp meta和设备像素比devicePixelRatio

时间:2014-11-03 19:17:44      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:style   http   io   ar   os   使用   for   sp   on   

webapp meta

 


<!-- 启用360浏览器的极速模式(webkit) – --><meta name="renderer" content="webkit">
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- 针对手持设备优化,主要是针对一些老的不识别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">
<!--这meta的作用就是删除默认的苹果工具栏和菜单栏-->
<meta name="apple-mobile-web-app-capable" content="yes">
<!--网站开启对web app程序的支持-->
<meta name="apple-touch-fullscreen" content="yes">
<!--手机号码不被显示为拨号链接-->
<meta name="format-detection" content="telephone=no">
<!--在web app应用下状态条(屏幕顶部条)的颜色-->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- windows phone 点击无高光 -->
<meta name="msapplication-tap-highlight" content="no">
<!--移动web页面是否自动探测电话号码-->
<meta http-equiv="x-rim-auto-match" content="none">

MobileOptimized

<meta name="MobileOptimized" content="width">
MobileOptimized 移动优化
fit-to-screen网站自适应屏幕
如果content的值小于或等于screen width 网站自适应屏幕fit-to-screen将被关闭网站不会随着浏览器拉伸缩放
如果content的值大于screen width;fit-to-screen将开启

viewport

    
<meta name="viewport" content="width=device-width,height=device-height, minimum-scale=1.0, maximum-scale=1.0,initial-scale=1, user-scalable=no"/>
width和height指令分别指定视区的逻辑宽度和高度。他们的值要么是以像素为单位的数字,要么是一个特殊的标记符号。width指令使用device-width标记可以指示视区宽度应为设备的屏幕宽度。类似地height指令使用device-height标记指示视区高度为设备的屏幕高度。
user-scalable指令指定用户是否可以缩放视区,即缩放Web页面的视图。值为yes时允许用户进行缩放,值为no时不允许缩放
initial-scale指令用于设置Web页面的初始缩放比例。默认的初始缩放比例值因智能手机浏览器的不同而有所差异。通常情况下设备会在浏览器中呈现出整个Web页面,设为1.0则将显示未经缩放的Web文档。
maximum-scale和minimum-scale指令用于设置用户对Web页面缩放比例的限制。值的范围为0.25至10.0之间。与initial-scale相同,这些指令的值是应用于视区内容的缩放比例。
所有智能手机浏览器都支持ViewPort <meta>标记的width和user-scalabel指令。但是Opera Mobile不使用user-scalable指令,而是主张用户应始终保留在移动浏览器中缩放Web页面的能力。
  1. apple-mobile-web-app-capable

      1.        <meta name="apple-mobile-web-app-capable" content="yes">
  2.       是否启动webapp功能 设置为yes 网站就会在满屏模式full-screen mode删除默认的苹果工具栏和菜单栏
      1. format-detection

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

        iPhone会自动把你这个文字加链接样式、并且点击这个数字还会自动拨号!

        telephone=no就忽略页面中的数字识别为电话号码

        telephone=yes就开启了把数字转化为拨号链接,在默认是情况下就是开启!

        status-bar-style

         

        <meta name=”apple-mobile-web-app-status-bar-style” content=”default” />
        <meta name=”apple-mobile-web-app-status-bar-style” content=”black” />
        <meta name=”apple-mobile-web-app-status-bar-style” content=”black-translucent” />

        1. 控制状态栏显示样式  default(白色)black(黑色) black-translucent(灰色半透明)

        link标签apple-touch-icon

         

        如果apple-mobile-web-app-capable设置为yes了,那么在iPhone,iPad,iTouch的safari上可以使用添加到主屏按钮将网站添加到主屏幕上。

        而通过设置相应apple-touch-icon标签,则添加到主屏上的图标就会使用我们指定的图片。

        以下是针对ox不同设备,选择一个最优icon。默认iphone的大小为60px,ipad为76px,retina屏乘以2倍。

        <link rel="apple-touch-icon" href="touch-icon-iphone.png">
        <link rel="apple-touch-icon" sizes="76x76" href="touch-icon-ipad.png">
        <link rel="apple-touch-icon" sizes="120x120" href="touch-icon-iphone-retina.png">
        <link rel="apple-touch-icon" sizes="152x152" href="touch-icon-ipad-retina.png">
        

        ios7以前系统默认会对图标添加特效(圆角及高光),如果不希望系统添加特效,则可以用apple-touch-icon-precomposed.png代替apple-touch-icon.png

        图标使用的优先级如下:

        • 如果没有跟相应设备推荐尺寸一致的图标,那个会优先使用比推荐尺寸大,但最接近推荐尺寸的图标。
        • 如果没有比推荐尺寸大的图标,会优先选择最接近推荐尺寸的图标。
        • 如些有多个图标符合推荐尺寸,会优先选择包含关键字precomposed的图标。

        如果未在区域指定用link标签指定图标,会自动搜索网站根目录下以apple-touch-icon为前缀的png图标。

        注:ios7不再为icon添加特效,ios7以前则默认为icon添加特效,除非icon有关键字-precomposed.png为后缀。

        devicePixelRatio

        window.devicePixelRatio是设备上物理像素和设备独立像素(device-independent pixels (dips))的比例。
              公式表示就是:window.devicePixelRatio = 物理像素 / dips      

webapp meta和设备像素比devicePixelRatio

标签:style   http   io   ar   os   使用   for   sp   on   

原文地址:http://www.cnblogs.com/zodiacblog/p/4071908.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!