最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Using the Apple meta tag for full-screen web app - Stack Overflow

programmeradmin1浏览0评论

I'm trying to use the

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

tag to get iOS Safari to show a page without the browser stuff; at least, that's what I think it's supposed to do for me. (The Apple documentation doesn't go into extensive detail.)

So far, I can't get it to do anything. Here is a JSBin example. With or with out the <meta> tag, the page es up on both an iPod Touch and an iPad 2 with the browser stuff at the top (and bottom on the little screen).

Is there something else that needs to happen in order to affect the browser? Or are my expectations of how it should work just incorrect? (Note that, via weinre, I've checked the "windows.navigator.standalone" flag, and it appears to be false.)

I'm trying to use the

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

tag to get iOS Safari to show a page without the browser stuff; at least, that's what I think it's supposed to do for me. (The Apple documentation doesn't go into extensive detail.)

So far, I can't get it to do anything. Here is a JSBin example. With or with out the <meta> tag, the page es up on both an iPod Touch and an iPad 2 with the browser stuff at the top (and bottom on the little screen).

Is there something else that needs to happen in order to affect the browser? Or are my expectations of how it should work just incorrect? (Note that, via weinre, I've checked the "windows.navigator.standalone" flag, and it appears to be false.)

Share Improve this question asked Oct 4, 2012 at 19:28 PointyPointy 414k62 gold badges594 silver badges626 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

That only does what you want when the user adds a link to your app to their home screen.

A mon approach for the in-browser case is to add a call to window.scroll(0,1) which will get the browser stuff off the top of the screen. (There is no way to clear the bottom stuff.)

Also, you might want a tag to say you do not want scaling:

<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, user-scalable=no, maximum-scale=1, minimum-scale=1" />

What the meta tag do is when you view your page in the browser, it adds an option to add your page to the homescreen. When you open your page via the homescreen shortcut, it will be in fullscreen and navigator.standalone will be set to true. This is what people refer to when they speak of the fullscreen mode.

发布评论

评论列表(0)

  1. 暂无评论