IOS 下webApp的启动画面设置

当通过IOS设备的safari打开我们的网站之后,可以将它们存到主屏幕上。这样使得它们更像一个app,通过对meta头标签的一些设置,更可以让应用以全屏的方式打开,这样就不会显示浏览器本身的地址栏等UI了。

更有趣的是,我们还能设置我们的webApp的桌面图标以及启动画面!

下面分别是iphone、ipod、ipad以及相应retina屏的图标及启动画面设置~需要注意的地方是启动画面的图片大小,在media属性我们可以看到宽高的值,但是这是包括了状态栏的,所以其实图片的真实大小的高度并不是media内的值而是href示例中的大小~

<!-- iPhone -->
       sizes = "57x57"
       rel = "apple-touch-icon" >
       media="(device-width: 320px) and (device-height: 480px)
          and (-webkit-device-pixel-ratio: 1)"
       rel = "apple-touch-startup-image" >
<!-- iPhone (Retina) -->
       sizes = "114x114"
       rel = "apple-touch-icon" >
       media="(device-width: 320px) and (device-height: 480px)
          and (-webkit-device-pixel-ratio: 2)"
       rel = "apple-touch-startup-image" >
<!-- iPhone 5 -->
       media="(device-width: 320px) and (device-height: 568px)
          and (-webkit-device-pixel-ratio: 2)"
       rel = "apple-touch-startup-image" >
<!-- iPad -->
       sizes = "72x72"
       rel = "apple-touch-icon" >
       media="(device-width: 768px) and (device-height: 1024px)
          and (orientation: portrait)
          and (-webkit-device-pixel-ratio: 1)"
       rel = "apple-touch-startup-image" >
       media="(device-width: 768px) and (device-height: 1024px)
          and (orientation: landscape)
          and (-webkit-device-pixel-ratio: 1)"
       rel = "apple-touch-startup-image" >
<!-- iPad (Retina) -->
       sizes = "144x144"
       rel = "apple-touch-icon" >
       media="(device-width: 768px) and (device-height: 1024px)
          and (orientation: portrait)
          and (-webkit-device-pixel-ratio: 2)"
       rel = "apple-touch-startup-image" >
       media="(device-width: 768px) and (device-height: 1024px)
          and (orientation: landscape)
          and (-webkit-device-pixel-ratio: 2)"
       rel = "apple-touch-startup-image" >

另外iphone5这个特殊尺寸的启动画面的设置会稍有不同,它的宽度必须设置成device-width或者320.并且scale设置成1.0。

<!-- Letterboxed on iPhone 5 -->
< meta  name = "viewport"
       content = "width=device-width" >
< meta  name = "viewport"
       content = "width=320" >
<!-- Not letterboxed on iPhone 5 -->
< meta  name = "viewport"
       content = "initial-scale=1.0" >
< meta  name = "viewport"
       content = "width=320.1" >
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值