Sha256: 87f0424e2dd664471477fa55643d285dd4608f46ebd021c2488fb9efc7273837

Contents?: true

Size: 656 Bytes

Versions: 5

Compression:

Stored size: 656 Bytes

Contents

(function () {
  function redirect() {
    var redirectTargetElement = document.getElementById("redirection-target");

    if (!redirectTargetElement) {
      return;
    }

    var targetInfo = JSON.parse(redirectTargetElement.dataset.target);
    var normalizedLink = document.createElement('a');
    normalizedLink.href = targetInfo.url;

    open(normalizedLink.href, '_top');
  }

  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

5 entries across 5 versions & 1 rubygems

Version Path
shopify_app-22.5.1 app/assets/javascripts/shopify_app/redirect.js
shopify_app-22.5.0 app/assets/javascripts/shopify_app/redirect.js
shopify_app-22.4.0 app/assets/javascripts/shopify_app/redirect.js
shopify_app-22.3.1 app/assets/javascripts/shopify_app/redirect.js
shopify_app-22.3.0 app/assets/javascripts/shopify_app/redirect.js