summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/navigation-timing/resources/iframe-prefetch-transfer-size.html
blob: fde01775b776d9a35b1ce8705f858bb9e750ce2e (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
29
30
31
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <title>Iframe Transfer Size Prefetch</title>
</head>

<body>
  <p>Placeholder</p>
  <script>
    const urlToPrefetch = 'blank_page_prefetch.html';

    function addLink() {
      return new Promise(resolve => {
        const link = document.createElement('link');
        link.onload = function () { resolve(); };
        link.rel = 'prefetch';
        link.as = 'document';
        link.href = urlToPrefetch;
        document.body.appendChild(link);
      });
    };

    function navigateToPrefetchedUrl() {
      document.location.href = urlToPrefetch;
    }
  </script>
</body>

</html>