summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/support/iframe-tried-to-be-navigated-by-history.html
blob: c4ba8011f9d288b488dcbd97d8499bcd0d37c152 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<p>This is a frame that tries to navigate via history API.</p>
<script>
window.onmessage = (e) => {
  if (e.data == 'back') {
    history.back();
  } else if (e.data == 'forward') {
    history.forward();
  } else if (e.data = 'pushstateback') {
    onpopstate = (e) => {
      parent.postMessage('pushstatebackdone', '*');
    };

    history.pushState({someState: 'blah'}, '');
    history.back();
  }
};
</script>