我创建了一个适用于Firefox但不适用于GoogleChrome的网站.该网站使用Web工作者,我收到常见错误消息:
"Uncaught SecurityError: Failed to create a worker: script at
'file:///home/useraccount/School/MasterThesis/Code/physijs_worker.js'
cannot be accessed from origin 'null'."
Run Code Online (Sandbox Code Playgroud)
我已经读过这篇文章了,本教程末尾(http://www.html5rocks.com/en/tutorials/workers/basics/)在"安全性"一词中对此进行了详细解释.
这是我的谷歌Chrome版本:
Google Chrome 32.0.1700.107 (Official Build 248368)
OS Linux
Blink 537.36 (@165586)
JavaScript V8 3.22.24.17
User Agent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
Command Line /usr/bin/google-chrome
--allow-access-from-files --flag-switches-begin
--ignore-gpu-blacklist --flag-switches-end
Run Code Online (Sandbox Code Playgroud)
在这里,我们可以看到--allow-access-from-files标志确实已设置.我在我的UBUNTU 13.10上运行它.
正如许多论坛所建议的那样,我还检查了URL链接是否完整.
有网站使用Three.js和Physi.js.
关于问题可能是一些建议会很好.