在iOS 7.0.2 版本上,若是從主屏幕進入webapp且webapp進入全屏模式,那麼alert和修改window.location到某產品對應的itunes下載頁面則無效。html
可參考下面的代碼示例:web
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="apple-mobile-web-app-capable" content="yes"/> <title>Untitled</title> <style> body {font-family:sans-serif;} </style> </head> <body> Press the following button to jump! Are you ready? <input type="button" onclick="jumpToITunes()" value="jump to!" /> <a href="#" onclick="jumpToITunes()">click me to jump</a> <span id="test"></span> <script> var jumpToITunes = function(){ document.getElementById('test').innerHTML = (new Date).getTime(); alert(1); window.location="https://itunes.apple.com/us/app/google-search/id284815942?mt=8"; }; </script> </body> </html>
不管點擊按鈕仍是a標籤,都會執行函數jumpToITunes。咱們在Safari打開此頁面並保存到主屏幕。再從主屏幕進入這個頁面。點擊按鈕,發現alert和修改location的行爲都是無效的。若是去掉全屏的那句meta標籤則沒有問題。另外在iOS最新版本7.0.3中,這個問題也沒有了。app
針對這個問題能夠考慮兩種解決方案:webapp
以上兩種策略能夠根據產品需求而定。函數