`

[转载]移动终端浏览器初始设置apple-mobile-web-app-capable

阅读更多
 

移动终端浏览器默认设置视口的宽度和初始规模。
最近做的一个移动终端的项目,遇到一个默认设置更改的问题。起初非常怀疑是自己的html写的有问题。经过一番页面尺寸的测试之后终于找到问题根源。知道是什么问题就可以找解决的方法了。
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,height=device-height"/>
<meta name="format-detection" content="telephone=no">
在页面的头部文件中加入了以上设定就ok了。以下是找到的有关于这些设定的解析。记录下来避免忘记。
然而这些设定只在移动终端的浏览器中有效,非移动终端浏览器这些设定是无效的。并且要这些浏览器是基于iPhone而来的。初次涉及移动终端的应用,恼人的事情不只这一件呢,呵呵O(∩_∩)O~  然,这件事情最有价值啊!

apple-mobile-web-app-capable

Sets whether a web application runs in full-screen mode.

Syntax
<meta name="apple-mobile-web-app-capable" content="yes">
Discussion

If content is set to yes, the web application runs in full-screen mode; otherwise, it does not. The default behavior is to use Safari to display web content.

You can determine whether a webpage is displayed in full-screen mode using the window.navigator.standalone read-only Boolean JavaScript property.

Availability

Available in iPhone OS 2.1 and later.

Support Level

Apple extension.

apple-mobile-web-app-status-bar-style

Sets the style of the status bar for a web application.

Syntax
<meta name="apple-mobile-web-app-status-bar-style" content="black">
Discussion

This meta tag has no effect unless you first specify full-screen mode as described in “url.”

If content is set to default, the status bar appears normal. If set to black, the status bar has a black background. If set to black-translucent, the status bar is black and translucent. If set to default or black, the web content is displayed below the status bar. If set to black-translucent, the web content is displayed on the entire screen, partially obscured by the status bar. The default value is default.

Availability

Available in iPhone OS 2.1 and later.

Support Level

Apple extension.

format-detection

Enables or disables automatic detection of possible phone numbers in a webpage in Safari on iPhone.

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

By default, Safari on iPhone detects any string formatted like a phone number and makes it a link that calls the number. Specifying telephone=no disables this feature.

Availability

Available in iPhone OS 1.0 and later.

Support Level

Apple extension.

viewport

Changes the logical window size used when displaying a page on iPhone.

Syntax
<meta name = "viewport" content = "width = 320,
       initial-scale = 2.3, user-scalable = no">
Discussion

Use the viewport meta key to improve the presentation of your web content on iPhone. Typically, you use the viewport meta tag to set the width and initial scale of the viewport.

For example, if your webpage is narrower than 980 pixels, then you should set the width of the viewport to fit your web content. If you are designing an iPhone-specific web application, you should set the width to the width of the device.

“email” describes the properties supported by the viewport meta key and their default values. When providing multiple properties for the viewport meta key, you should use a comma-delimited list of assignment statements.

When referring to the dimensions of a device, you should use the constants described in “number” instead of hard-coding specific numeric values. For example, use device-width instead of320 for the width, and device-height instead of 480 for the height in portrait orientation.

You do not need to set every viewport property. If only a subset of the properties are set, then Safari on iPhone infers the other values. For example, if you set the scale to 1.0, Safari assumes the width is device-width in portrait and device-height in landscape orientation. Therefore, if you want the width to be 980 pixels and the initial scale to be 1.0, then set both of these properties.

For example, to set the viewport width to the width of the device, add this to your HTML file:

<meta name = "viewport" content = "width = device-width">

To set the initial scale to 1.0, add this to your HTML file:

<meta name = "viewport" content = "initial-scale = 1.0">

To set the initial scale and to turn off user scaling, add this to your HTML file:

<meta name = "viewport" content = "initial-scale = 2.3, user-scalable = no">

Use the Safari on iPhone console to help debug your webpages as described in “Debugging”. The console contains tips to help you choose viewport values—for example, it reminds you to use the constants when referring to the device width and height.

Availability

Available in iPhone OS 1.0 and later.

Support Level

Apple extension.

 

转自:http://blog.sina.com.cn/s/blog_4dffbd380100kvht.html

分享到:
评论

相关推荐

    doctype html

    meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-...&lt;meta name="apple-mobile-web-app-capable" content="yes" /&gt; &lt;meta name="apple-mobile-web-app-status-bar-style" content="black

    元旦倒计时代码-元旦倒计时.html

    &lt;meta name="apple-mobile-web-app-capable" content="yes"&gt; &lt;meta name="apple-mobile-web-app-status-bar-style" content="black"&gt; &lt;meta http-equiv="Cache-Control" content="no-transform"&gt; ...

    中奖了手机表单模板

    &lt;!...&lt;... &lt;head&gt;...meta name="apple-mobile-web-app-capable" content="yes"&gt; &lt;meta name="apple-mobile-web-app-status-bar-style" content="black"&gt; &lt;/head&gt; &lt;style&gt;

    刮刮卡代码

    &lt;meta name="apple-mobile-web-app-capable" content="yes"&gt; &lt;meta name="apple-mobile-web-app-status-bar-style" content="black"&gt; &lt;meta name="format-detection" content="telephone=no"&gt; 乐享微信"&gt; ...

    jQuery-红包泡泡点击抽奖代码.zip

    meta name="apple-mobile-web-app-capable" content="yes"&gt; &lt;meta name="apple-touch-fullscreen" content="yes"&gt; &lt;meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"&...

    iosweblinks:使 iOS 网络应用程序链接在网络应用程序视图中打开

    meta name =" apple-mobile-web-app-capable " content =" yes " &gt; &lt;!-- this is the only required meta --&gt; &lt; meta name =" apple-mobile-web-app-status-bar-style " content =" black " &gt; ...

    Mobile-Web-Tech:一些常用的移动开发有关信息和常见问题解决方案

    meta content="yes" name="apple-mobile-web-app-capable" /&gt;&lt;meta content="black" name="apple-mobile-web-app-status-bar-style" /&gt;&lt;meta content="telephone=no" name="format-detection" /&gt;第

    Meeting the design requirements for Bi-Directional-Capable OBC

    Meeting the design requirements for Bi-Directional-Capable OBC

    zepto手机移动端拼音字母城市选择代码.zip

    meta name="apple-mobile-web-app-capable" content="yes"&gt; &lt;meta name="apple-mobile-web-app-status-bar-style" content="black"&gt; &lt;meta name="format-detection" content="telephone=no"&gt; &lt;...

    答题送福利

    &lt;meta name="apple-mobile-web-app-capable" content="yes"&gt; &lt;meta name="apple-mobile-web-app-status-bar-style" content="black"&gt; &lt;meta http-equiv="Expires" content="-1"&gt; &lt;meta http-equiv="pragram" ...

    Mobile-Web-Tech:移动端前端开发资料库

    移动端前端开发资料库 基于 mobileTech 上完善,...meta content="yes" name="apple-mobile-web-app-capable" /&gt; &lt;meta content="black" name="apple-mobile-web-app-status-bar-style" /&gt; &lt;meta content=

    移动端web开发技巧与经验分享

    移动端web开发技巧汇总与经验分享,已经涵盖了web移动端...user-scalable u2033name=”viewport”/&gt;(2)”name=”apple-mobile-web-app-capable”/&gt;(3)”name=”apple-mobile-web-app-status-bar-style”/&gt;(4)&lt;metaco

    手机/移动前端开发需要注意的20个要点

    1、首先我们来看看webkit内核中的一些私有的meta标签,这些meta标签...meta content=yes name=apple-mobile-web-app-capable&gt; &lt;meta content=black name=apple-mobile-web-app-status-bar-style&gt; &lt;meta co

    H5 meta小结(前端必看篇)

    如下所示: &lt;meta name=viewport content=width=device-width,initial-scale=1,minimum-scale=1,...meta name=apple-mobile-web-app-capable content=yes&gt; &lt;meta name=apple-mobile-web-app-status-bar-st

    jQuery实现移动端扭蛋机抽奖

    本文实例为大家分享了jQuery实现移动端扭蛋机抽奖的具体代码,供大家参考,具体内容如下 &lt;...meta name=apple-mobile-web-app-capable content=yes /&gt; &lt;meta name=apple-mobile-web-app-

    一些有用的meta设置方法(必看)

    meta name="apple-mobile-web-app-capable" content="yes"&gt; &lt;meta name="apple-mobile-web-app-status-bar-style" content="#6f9ddc"&gt; &lt;!– 页面的编码方式 –&gt; &lt;meta charset=

    js微信支付实现代码

    本文实例为大家分享了js微信支付的具体代码,供大家参考,具体内容如下 &lt;...meta name=apple-mobile-web-app-capable content=yes /&gt; &lt;meta name=apple-mobile-web-app-status-bar-styl

    Vue 仿百度搜索功能实现代码

    无上下选择 &lt;!...&lt;... &lt;head&gt;...meta charset="UTF-8"&gt;...meta name="viewport" content="width=...meta name="apple-mobile-web-app-capable" content="yes"&gt; &lt;meta name="apple-mobile-web-app-status-

    Vue实现搜索 和新闻列表功能简单范例

    meta name="apple-mobile-web-app-capable" content="yes"&gt; &lt;meta name="apple-mobile-web-app-status-bar-style" content="black"&gt; &lt;meta name="format-detection" content="telephone=no"&gt; &lt;...

    纯js+css实现仿移动端淘宝网站的弹出详情框功能

    meta name="apple-mobile-web-app-capable" content="yes"&gt; &lt;meta name="apple-mobile-web-app-status-bar-style" content="black"&gt; &lt;meta name="format-detection" content="telephone=no"&gt; &lt;...

Global site tag (gtag.js) - Google Analytics