-
-
Save artlung/db7390a418aa0e718857 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
function getParameterByName(name) { | |
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); | |
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), | |
results = regex.exec(location.search); | |
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); | |
} | |
var meta = document.getElementsByTagName('meta'); | |
var apple_launch_elem; | |
for (var i=0;i < meta.length; i++) { | |
var elem = meta[i]; | |
if (elem.getAttribute('name') === 'apple-itunes-app') { | |
apple_launch_elem = elem; | |
} | |
} | |
var launchurl = getParameterByName('launchurl'); | |
if (apple_launch_elem) { | |
var tmp = apple_launch_elem.getAttribute('content'); | |
apple_launch_elem.setAttribute('content', tmp + ', app-argument=' + decodeURIComponent(launchurl)); | |
} |
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
<script> | |
function getParameterByName(name) { | |
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); | |
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), | |
results = regex.exec(location.search); | |
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); | |
} | |
var appleAppStoreID = "298307011"; | |
var playLink = getParameterByName('launchurl'); | |
document.writeln('<meta name="apple-itunes-app" content="app-id='+appleAppStoreID+', app-argument='+playLink+'" \/>'); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment