Last active
March 29, 2022 08:12
-
-
Save jpallen/056a07a846405f8e9528c375a0be6826 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
<html> | |
<head> | |
<title>Deep Link Test</title> | |
<script | |
src="https://code.jquery.com/jquery-3.6.0.min.js" | |
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" | |
crossorigin="anonymous"></script> | |
</head> | |
<body> | |
<button id="useProduction">Use Production</button><br> | |
<button id="useStaging">Use Staging</button><br> | |
<input id='url' value="cogo-uk://"></input><br> | |
<input type="radio" id="immediate" name="timing" value="immediate" checked> | |
<label for="child">Immediate</label><br> | |
<input type="radio" id="delayed" name="timing" value="adult"> | |
<label for="adult">Delayed</label><br> | |
<button id="go">Go!</button> | |
<script> | |
function doRedirect() { | |
window.location.href = $("#url").val() | |
} | |
let redirectSoon = false | |
setInterval(function() { | |
if (redirectSoon) { | |
doRedirect() | |
redirectSoon = false | |
} | |
}, 1000) | |
$("#go").click(function() { | |
console.log("clicked!") | |
redirectSoon = false | |
const timing = $('input[name="timing"]:checked').val() | |
if (timing === 'immediate') { | |
doRedirect() | |
} else { | |
redirectSoon = true | |
} | |
}) | |
$("#useProduction").click(function() { | |
$("#url").val("cogo-uk://") | |
}) | |
$("#useStaging").click(function() { | |
$("#url").val("cogo-uk-stage://") | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment