summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/cookies/samesite/resources/navigate.html
blob: 88de6dff92e5fb5da956abae7b712698343d86ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<meta charset="utf-8">
<script src="/cookies/resources/cookie-helper.sub.js"></script>
<script>
  window.addEventListener('load', function() {
    if (window.opener)
      window.opener.postMessage({ type: 'READY' }, '*');
    if (window.parent !== window)
      window.parent.postMessage({ type: 'FRAME_READY' }, '*');
  });

  window.addEventListener('message', function(e) {
    if (e.data.type === "navigate") {
      window.location = e.data.url;
    }

    if (e.data.type === "post-form") {
      var f = document.createElement('form');
      f.action = e.data.url;
      f.method = "POST";
      document.body.appendChild(f);
      f.submit();
    }
  });
</script>