summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/history/the-location-interface/resources/replace-or-assign-call-on-iframe.html
blob: bdad8334a5e65d556d35474c051bdb9e1bcad4e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE HTML>
<html>
  <head>
    <title>Referer with location.replace and location.assign</title>
  </head>
  <body>
    <iframe src="/resources/blank.html" hidden></iframe>
    <script>
      window.addEventListener('message', function (e) {
        const referrer = e.data;
        window.parent.postMessage(referrer);
      });
      if (window.location.search === "?replace") {
        document.querySelector("iframe").contentWindow.location.replace("iframe-contents.sub.html?replace");
      } else if (window.location.search === "?assign") {
        document.querySelector("iframe").contentWindow.location.assign("iframe-contents.sub.html?assign");
      }
    </script>
  </body>
</html>