Created
October 17, 2016 23:25
-
-
Save ogero/32c5ab65fa1c7ea44dfd35763a2de443 to your computer and use it in GitHub Desktop.
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
<!doctype html> | |
<html> | |
<head> | |
<style> | |
a.launch{ | |
display: block; | |
text-align: center; | |
} | |
</style> | |
</head> | |
<body> | |
<script> | |
var LINK_TEXT='Lanzar App'; | |
var APPLINK='labandatransporte://'; | |
var STORELINK='market://details?id=app.labandatransporte'; | |
window.linkAdded=false; | |
var fallbackFunction = function() { | |
if(window.linkAdded==false){ | |
window.linkAdded=true; | |
var a = document.createElement("a"); | |
var aText = document.createTextNode(LINK_TEXT); | |
a.appendChild(aText); | |
a.className="launch"; | |
a.href="#"; | |
a.onclick=function(){ | |
return doMagic(); | |
}; | |
document.body.appendChild(a); | |
} | |
window.location.replace(STORELINK); | |
}; | |
var addIFrame = function() { | |
var iframe = document.createElement("iframe"); | |
iframe.style.border = "none"; | |
iframe.style.width = "1px"; | |
iframe.style.height = "1px"; | |
iframe.src = APPLINK; | |
document.body.appendChild(iframe); | |
}; | |
var doMagic = function(){ | |
addIFrame(); | |
setTimeout(fallbackFunction, 1000); | |
return false; | |
} | |
doMagic(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment