-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sandbox prevents creating web worker #1010
Comments
Probably more like a feature of iframe sandboxing, but as a workaround it works this way: function createWebworker() {
// via http://www.html5rocks.com/en/tutorials/workers/basics/#toc-inlineworkers
var blob = new Blob([
"onmessage = function(e) { postMessage('msg from worker'); }"]);
var blobURL = window.URL.createObjectURL(blob);
console.log(blobURL)
var worker = new Worker(blobURL);
worker.onmessage = function(e) {
document.getElementById('webworker_result').textContent = event.data;
};
worker.postMessage("hello");
} |
I know, this is closed, but don't service workers need https anyways?! PS.: This can be achieved through visiting zeronet via localhost instead of 127.0.0.1 (at least as far as I remember (at least in chrome)). |
web worker is not same as service worker. |
@HelloZeroNet Ah wow, I did so much research on workers, but till now, I didn't quite understand the differences 😅 |
new Worker("worker.js")
merely fails:Uncaught DOMException: Failed to construct 'Worker': Script at 'http://127.0.0.1:43110/[site address]/worker.js' cannot be accessed from origin 'null'.
No idea about whether disallowing web workers should be a bug or a feature.
The text was updated successfully, but these errors were encountered: