Created
January 18, 2013 07:02
-
-
Save munky69rock/4562867 to your computer and use it in GitHub Desktop.
iPhone Safari: check if URL scheme is supported in javascript
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
// cf: http://stackoverflow.com/questions/627916/iphone-safari-check-if-url-scheme-is-supported-in-javascript | |
function checkUrlScheme(app_url_scheme, app_install_url, app_name) { | |
document.location = app_url_scheme; | |
setTimeout(function() { | |
if(confirm('You do not seem to have '+app_name+' installed, do you want to go download it now?')){ | |
document.location = app_install_url; | |
} | |
}, 300); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What about Android? The android chrome navigates to the next page even if the url scheme is not supported.