Created
December 1, 2015 16:07
-
-
Save andreasvirkus/31038965c6b8e61bceb2 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
// Simple check so we could use a single button for different mobile OS-s | |
var operatingSystem, userAgentString = navigator.userAgent; | |
var link = $("#store"); | |
if (userAgentString.indexOf("iPhone") > -1 || userAgentString.indexOf("iPod") > -1 || userAgentString.indexOf("iPad") > -1) { | |
operatingSystem = "iOS"; | |
link.attr("href", "http://store.apple.com/us/browse/app"); | |
} else if (/Android/.test(userAgentString)) { | |
operatingSystem = "Android"; | |
link.attr("href", "https://play.google.com/store/apps?hl=en"); | |
} else if (/Windows Phone/.test(userAgentString)) { | |
operatingSystem = "Windows Phone"; | |
link.attr("href", "http://www.windowsphone.com/en-us/store"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment