Debian Codegraph @

testing/web-platform/mozilla/tests/fetch/fetchpriority/support/link-tests/link-dynamic-prefetch.h2.html

raw
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="UTF-8">
5 <title>fetchpriority</title>
6 </head>
7 <body>
8 <script>
9 onload = function() {
10 const kData = [
11 { href: "../resources/dummy.txt?1", fetchPriority: "low" },
12 { href: "../resources/dummy.txt?2", fetchPriority: "high" },
13 { href: "../resources/dummy.txt?3", fetchPriority: "auto" },
14 { href: "../resources/dummy.txt?4" }
15 ];
16
17 let allLinkElements = [];
18 for (data of kData) {
19 let linkElement = document.createElement("link");
20 linkElement.rel = "prefetch";
21 linkElement.href = data.href;
22
23 if ("fetchPriority" in data) {
24 linkElement.fetchPriority = data.fetchPriority;
25 }
26
27 allLinkElements.push(linkElement);
28 }
29
30 document.head.append(...allLinkElements)
31
32 opener.postMessage("ChildLoaded", "*");
33 }
34 </script>
35 </body>
36 </html>