`

[转载]移动终端浏览器初始设置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

分享到:
评论

相关推荐

    WebApp里的Meta标签大全

    &lt;meta name="apple-mobile-web-app-capable" content="yes"&gt; ``` 此标签告诉iOS设备,该WebApp可以像原生应用一样全屏运行。 ##### Status Bar Style ```html &lt;meta name="apple-mobile-web-app-status-bar-style" ...

    移动开发总结

    - `&lt;meta name="apple-mobile-web-app-capable" content="yes"/&gt;`:当用户将网页添加到iOS设备的主屏幕后,再次打开时,浏览器会隐藏地址栏,提供更接近原生应用的体验。 - `&lt;meta name="apple-mobile-web-app-...

    webkit webApp 开发技术要点总结

    例如,通过`&lt;meta name="apple-mobile-web-app-capable" content="yes" /&gt;`标签,可以使WebApp在iOS设备上具备类似原生应用的全屏体验;而`&lt;meta name="apple-mobile-web-app-status-bar-style" content="black" /&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...

    移动端html5 meta标签的神奇功效

    本文将深入探讨移动平台的Meta标签,尤其是viewport、format-detection和apple-mobile-web-app-capable这三大特性。 首先,我们来了解Meta标签中的viewport。Viewport是移动设备上用于显示网页的实际可视区域,不同...

    H5 meta小结(前端必看篇)

    3. **苹果应用模式元标签 (`&lt;meta name="apple-mobile-web-app-capable"&gt;`)** `&lt;meta name="apple-mobile-web-app-capable" content="yes"&gt;` 当设置为`yes`时,告诉iOS设备可以将网页作为独立的Web应用程序(离线...

    HTML5head头标签.pdf

    最后,&lt;meta name="apple-mobile-web-app-title"&gt;和&lt;meta name="apple-mobile-web-app-capable" content="yes"&gt;等标签是针对苹果设备的特定设置。前者用于定义在iOS设备上启动网页应用时显示的标题,而后者则用于...

    项目实战小总结

    - **全屏浏览**: `&lt;meta content="yes" name="apple-mobile-web-app-capable"&gt;` - **作用**: 在iOS的Safari浏览器中启用全屏浏览模式。 - **状态栏样式**: `&lt;meta content="black" name="apple-mobile-web-app-...

    meta标签在移动平台开发中的应用详解

    再者,`&lt;meta name="apple-mobile-web-app-capable" content="yes"&gt;`是一个专为苹果设备设计的`meta`标签,它能使得网页以独立的Web应用程序(Web App)模式运行,隐藏掉浏览器的工具栏和菜单栏,提供更接近原生应用...

    ios 网站套壳源码 webapp

    2. **定制启动画面**:为了提高用户体验,通常需要为Webapp设计一个启动画面,这可以通过设置HTML的meta标签实现,如`&lt;meta name="apple-mobile-web-app-capable" content="yes"&gt;`和`&lt;link rel="apple-touch-startup...

    HTML常用meta大全(推荐)

    - `&lt;meta name="apple-mobile-web-app-capable" content="yes"&gt;`开启WebApp全屏模式,移除iOS设备顶部的地址栏和底部的工具栏。 - `&lt;meta name="apple-touch-fullscreen" content="yes"&gt;`与上一个类似,也用于开启...

    HTML5头部meta标签的一些常用信息小结

    - `&lt;meta name="apple-mobile-web-app-capable" content="yes"&gt;`:启用Web App全屏模式。 - `&lt;meta name="apple-mobile-web-app-status-bar-style" content="black-translucent/black/default"&gt;`:设置iOS设备状态...

    原生js实现移动开发轮播图、相册滑动特效

    - 文档中提到了`&lt;meta&gt;`标签的`apple-mobile-web-app-title`和`apple-mobile-web-app-capable`,这表示了可以将网页作为iOS设备上的应用程序运行,并启用全屏模式。 - 这对于提升用户在移动设备上的浏览体验非常...

    HTML5中meta属性的使用方法

    - `&lt;meta name="apple-mobile-web-app-capable" content="yes" /&gt;` 启用WebApp全屏模式,使网页看起来更像原生应用。 - `&lt;meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"&gt;` 设置...

    HTML5头部&lt;meta&gt;标签的一些常用信息小结

    &lt;meta name="apple-mobile-web-app-capable" content="yes"/&gt; &lt;meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/&gt; ``` 12. 禁止识别电话号码 禁止页面上的数字被浏览器识别为电话...

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

    `&lt;meta name="apple-mobile-web-app-capable" content="yes"&gt;` 在iOS设备上,这将使网站在添加到主屏幕后以独立的App形式运行,无浏览器工具栏,提供更接近原生App的体验。 4. **设置状态栏风格**: `...

Global site tag (gtag.js) - Google Analytics