Skip to content

Instantly share code, notes, and snippets.

@mishagray
Created May 28, 2015 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mishagray/b2173aa9889ada11a4da to your computer and use it in GitHub Desktop.
Save mishagray/b2173aa9889ada11a4da to your computer and use it in GitHub Desktop.
googles deep link logic in javascript form
<!DOCTYPE html>
<html>
<body>
<script type='text/javascript'>
var _oai = function(a, c, d, e, g) {
if (a)
if (c) {
var h = Date.now(),
k = window.history.length,
b = document.createElement("iframe");
b.style.display = "none";
window.document.body.appendChild(b);
var f = Date.now();
b.src = c;
setTimeout(function() {
Date.now() - f > e + (f - h) ? window.history.length > k ? window.history.back() : setInterval(function() {
window.close()
}, g) : (window.history.replaceState({}, "", "/?ref=" + d), location.assign(a))
}, e)
} else window.history.replaceState({}, "", "/?ref=" + d), location.assign(a)
};
_oai('https:\/\/maps.google.com\/?q\x3dGoogle%20Bldg%2041%2C%201600%20Amphitheatre%20Pkwy%2C%20Mountain%20View%2C%20CA%2094043\x26ftid\x3d0x808fba02f3d60bc5:0x6bc3b76cb42de9de\x26hl\x3den\x26gl\x3dus', 'comgooglemapsurl:\/\/maps.google.com?q\x3dGoogle%20Bldg%2041%2C%201600%20Amphitheatre%20Pkwy%2C%20Mountain%20View%2C%20CA%2094043\x26ftid\x3d0x808fba02f3d60bc5:0x6bc3b76cb42de9de\x26hl\x3den\x26gl\x3dus', 'http:\/\/googlewebmastercentral.blogspot.com\/2015\/05\/app-deep-linking-with-googl.html?m\x3d1', 1300.0, 500.0);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment