Created
December 16, 2013 06:08
-
-
Save ringular/7982958 to your computer and use it in GitHub Desktop.
Mobile app protocol redirect
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
var url; | |
var app_protocol = "YOUR_APP_PROTOCOL_HERE:/" | |
var app_path = window.location.pathname | |
if (/Android/i.test(navigator.userAgent)) { | |
url = "ANDROID_APP_URL"; | |
} | |
if (/iPhone/i.test(navigator.userAgent)) { | |
url = "IPHONE_APP_URL"; | |
} | |
setTimeout(function() { | |
window.location.href = url; | |
}, 25); | |
window.location.href = app_protocol + app_path; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
+1