Created
October 28, 2013 10:18
-
-
Save paingpyi/7194459 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta name = "viewport" content = "user-scalable=no, initial-scale=1.0, maximum-scale=1.0, width=device-width"> | |
</head> | |
<body> | |
<script> | |
var TimerInterval = 3000; | |
var isMobile = { | |
Android: function() { | |
return navigator.userAgent.match(/Android/i); | |
}, | |
BlackBerry: function() { | |
return navigator.userAgent.match(/BlackBerry/i); | |
}, | |
iOS: function() { | |
return navigator.userAgent.match(/iPhone|iPad|iPod/i); | |
}, | |
Opera: function() { | |
return navigator.userAgent.match(/Opera Mini/i); | |
}, | |
Windows: function() { | |
return navigator.userAgent.match(/IEMobile/i); | |
}, | |
any: function() { | |
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); | |
} | |
}; | |
if( isMobile.iOS() ){ | |
alert('iOS. Redirecting in 3 sec'); | |
setTimeout(function(){ | |
window.location.replace('https://itunes.apple.com/sg/app/mcdelivery/id486335709'); | |
},TimerInterval); | |
} | |
else if( isMobile.Android() ){ | |
alert('Android. Redirecting in 3 sec'); | |
setTimeout(function(){ | |
window.location.replace('https://play.google.com/store/apps/details?id=sg.com.mcdelivery'); | |
},TimerInterval); | |
}else{ | |
alert('Not mobile. Redirecting in 3 sec'); | |
setTimeout(function(){ | |
window.location.replace('https://google.com'); | |
},TimerInterval); | |
} | |
startTimer(); | |
function startTimer(interval){ | |
var timer = setInterval(function(){ | |
element = document.getElementById("counter"); | |
var c = parseInt(element.innerHTML); | |
if(c > 0) | |
element.innerHTML = c-1; | |
else | |
clearInterval(timer); | |
},1000) | |
} | |
</script> | |
<h1 style="font-size:20em;text-align:center;" id="counter">3</h1> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment