Created
April 23, 2018 17:41
-
-
Save realsby/bae4993131ef03054af1a264599776e8 to your computer and use it in GitHub Desktop.
Redirect mobile app in browser
This file contains 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
getMobileOperatingSystem(); | |
function getMobileOperatingSystem() { | |
var userAgent = navigator.userAgent || navigator.vendor || window.opera; | |
if (/android/i.test(userAgent)) { | |
window.location = "https://play.google.com/store/apps/details?id=TTTTTTT" | |
return "Android"; | |
} | |
if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) { | |
window.location = "https://itunes.apple.com/us/app/TTTTTTT/TTTTTTT"; | |
return "iOS"; | |
} | |
return "unknown"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment