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 = [
{ href: "../resources/dummy.js?1", fetchPriority: "low" },
{ href: "../resources/dummy.js?2", fetchPriority: "high" },
{ href: "../resources/dummy.js?3", fetchPriority: "auto" },
{ href: "../resources/dummy.js?4" }
];
let allLinkElements = [];
for (data of kData) {
let linkElement = document.createElement("link");
linkElement.rel = "modulepreload";
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>