Sha256: 12e1d2f7e612c192905c713f984b22a42c85ca0cc77b6478849b5af260b6a727
Contents?: true
Size: 760 Bytes
Versions: 1
Compression:
Stored size: 760 Bytes
Contents
document.addEventListener("DOMContentLoaded", function() { var redirectTargetElement = document.getElementById("redirection-target"); 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); } });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shopify_app-8.2.6 | app/assets/javascripts/shopify_app/redirect.js |