Skip to content

Instantly share code, notes, and snippets.

@ranbena
Created December 19, 2012 11:25
Show Gist options
  • Save ranbena/4336044 to your computer and use it in GitHub Desktop.
Save ranbena/4336044 to your computer and use it in GitHub Desktop.
A workaround to detecting if a native app is installed on the hosting mobile device.
<button id="btn1">Open Facebook app</button>
// define links
var native = "fb://",
download = "https://itunes.apple.com/en/app/facebook/id284882215";
// attach listener
var btn1 = document.getElementById("btn1");
btn1.addEventListener("click", function() {
NativeLink.open(legitNative, download);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment