Sha256: d06bb883a066d6e08e36f359ba06b8054f5fda5a5d1b481e846ee1fe6596d6d1
Contents?: true
Size: 1.07 KB
Versions: 73
Compression:
Stored size: 1.07 KB
Contents
(function() { function redirect() { var redirectTargetElement = document.getElementById("redirection-target"); if (!redirectTargetElement) { return; } var targetInfo = JSON.parse(redirectTargetElement.dataset.target) if (window.top == window.self) { // If the current window is the 'parent', change the URL by setting location.href window.top.location.href = targetInfo.url; } else { // If the current window is the 'child', change the parent's URL with postMessage normalizedLink = document.createElement('a'); normalizedLink.href = targetInfo.url; data = JSON.stringify({ message: 'Shopify.API.remoteRedirect', data: {location: normalizedLink.href} }); window.parent.postMessage(data, targetInfo.myshopifyUrl); } } document.addEventListener("DOMContentLoaded", redirect); // In the turbolinks context, neither DOMContentLoaded nor turbolinks:load // consistently fires. This ensures that we at least attempt to fire in the // turbolinks situation as well. redirect(); })();
Version data entries
73 entries across 73 versions & 1 rubygems