Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE html>
<meta charset="utf-8">
<title>Worker Fetcher</title>
<script>
window.addEventListener("message", function (evt) {
let { url } = evt.data;
const worker = new Worker(url);
worker.addEventListener("message", (evt) => {
parent.postMessage(evt.data, "*");
});
worker.addEventListener("error", (evt) => {
parent.postMessage({ error: evt.message || "unknown error" }, "*");
});
});
</script>