Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>fetchpriority</title>
</head>
<body>
<script>
onload = function() {
const kData = [
{ as: "fetch", href: "../resources/dummy.txt?1", fetchPriority: "low" },
{ as: "fetch", href: "../resources/dummy.txt?2", fetchPriority: "high" },
{ as: "fetch", href: "../resources/dummy.txt?3", fetchPriority: "auto" },
{ as: "fetch", href: "../resources/dummy.txt?4" },
];
let allLinkElements = [];
for (data of kData) {
let linkElement = document.createElement("link");
linkElement.rel = "preload";
linkElement.as = data.as;
linkElement.href = data.href;
if ("fetchPriority" in data) {
linkElement.fetchPriority = data.fetchPriority;
}
allLinkElements.push(linkElement);
}
document.head.append(...allLinkElements)
opener.postMessage("ChildLoaded", "*");
}
</script>
</body>
</html>