Skip to content

Instantly share code, notes, and snippets.

@uupaa
Last active December 23, 2015 21:29
Show Gist options
  • Save uupaa/6696971 to your computer and use it in GitHub Desktop.
Save uupaa/6696971 to your computer and use it in GitHub Desktop.
iOS7 MobileSafari app change spec.

iOS7 MobileSafari apple-mobile-web-app-status-bar-style に default を指定するとステータスが非表示に

iOS 6 MobileSafari から実装が変化しています。

iOS 7 MobileSafari で、Webページをアプリ化し、apple-mobile-web-app-status-bar-style に default を指定していると、ステータスバーが真っ黒になります。
その状態ではローディングインジケーターも含め時刻や電波の状況などのステータスが一切表示されない状態になります。

XHRで通信が発生しても、ステータスバーでカーソルがクルクルしません。

App開発者から見ると、通信中にローディングインジケーターを見せないのはAppleのアプリ審査基準的にアウトだったはずなので、これは気になります(MobileSafari上で動作するWebAppに審査基準はありませんが、念の為)。

<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default">
</head>
<script>
window.onload = function() {
  var xhr = new XMLHttpRequest();

  xhr.onload = function() { alert("onload"); }
  xhr.onerror = function() { alert("onerror"); }
  xhr.open("GET", "http://example.com/", true);
  xhr.send();
}
</script>

image

black は iOS 6 と同じ見た目になります

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

black-translucent は black ではなく translucent 的な見た目になります

<meta name="apple-mobile-web-app-status-bar-style" content="translucent">

image

iOS7 MobileSafari apple-mobile-web-app-capable = yes で alert 系の動作が無効化される

iOS 6 MobileSafari から実装が変化しています。

apple-mobile-web-app-capable = yes にすると、alert() や prompt() が封印されます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment