summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/navigation-api/navigate-event/cross-window/resources/cross-origin-iframe-helper.html
blob: 3393a2ecaa9e6520735d0afc5fb22ac843229943 (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
26
27
28
<!DOCTYPE html>
<script>
navigation.onnavigate = e => {
  const message = {
    navigationType: e.navigationType,
    cancelable: e.cancelable,
    canIntercept: e.canIntercept,
    userInitiated: e.userInitiated,
    hashChange: e.hashChange,
    formData: e.formData,
    destination: {
      url: e.destination.url,
      sameDocument: e.destination.sameDocument,
      key: e.destination.key,
      id: e.destination.id,
      index: e.destination.index
    }
  };
  e.preventDefault();
  top.postMessage(message, "*");
};

window.onload = () => {
  if (location.href.includes("postMessage-top-when-done")) {
    top.postMessage("DONE", "*");
  }
};
</script>