Skip to content

Instantly share code, notes, and snippets.

@ringular
Created December 16, 2013 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ringular/7982958 to your computer and use it in GitHub Desktop.
Save ringular/7982958 to your computer and use it in GitHub Desktop.
Mobile app protocol redirect
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;
@mahasen
Copy link

mahasen commented Dec 16, 2013

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment