Created
July 8, 2014 17:00
-
-
Save anonymous/a135239b522224121b3a 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)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment