Skip to content

Commit

Permalink
Added a check of iOS 4.
Browse files Browse the repository at this point in the history
  • Loading branch information
cantrell committed Oct 28, 2011
1 parent b42156a commit 382a692
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compass.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CACHE MANIFEST

# Version: 1
# Version: 1.01

CACHE:
index.html
Expand Down
7 changes: 7 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,12 @@
start();
alert('Only WebKit-based browsers are supported at this time.');
}
else if (ua.indexOf('iphone os 4') != -1)
{
hasCompass = false;
start();
alert('This application requires iOS 5 or higher.');
}
else if (window.DeviceOrientationEvent)
{
window.addEventListener('deviceorientation', compassTest);
Expand All @@ -467,6 +473,7 @@

function compassTest(event)
{
console.log(navigator.userAgent);
window.removeEventListener('deviceorientation', compassTest);
if (event.webkitCompassHeading != undefined || event.alpha != null) // Device does have a compass
{
Expand Down

0 comments on commit 382a692

Please sign in to comment.