1
When trying to create a worker
var worker = new Worker('teste.js');
I receive the following message:
Uncaught Securityerror: Failed to Construct 'Worker': Script at 'file://C:/..... /js/teste.js' cannot be accessed from origin 'null'.
Agree with that answer in Soen, link, cannot load the local file. Is there any alternative way to run this?
Note: I use Google Chrome and Firefox
A comment on the answer there is saying that Firefox has no problem loading local files as long as its script is also local. Tried that?
– Pablo Almeida
It seems that in firefox runs even, but the problem is in Chorme, I have to make wheels in both s:
– Rafael
But this isn’t just for tests?
– Pablo Almeida
Yes but I intend to implement, but if it does not work in the main browsers becomes complicated
– Rafael
When you are hosted on a server it will work. It only happens locally. You can develop in Firefox or Safari without worries.
– Pablo Almeida
I was testing in Firefox, it error when a new Worker, returns following message,
SecurityError: The operation is insecure.
– Rafael
I published a reply summarizing the solution to the general problem with a link to an example running in Firefox. Feel free to open up a new question for your specific case, as we are already heading in another direction here.
– Pablo Almeida