Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/453.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript &引用;physi.js“;导致该错误的原因是:";无法从源代码访问脚本';空'&引用;_Javascript_Three.js_Physics Engine_Physijs - Fatal编程技术网

Javascript &引用;physi.js“;导致该错误的原因是:";无法从源代码访问脚本';空'&引用;

Javascript &引用;physi.js“;导致该错误的原因是:";无法从源代码访问脚本';空'&引用;,javascript,three.js,physics-engine,physijs,Javascript,Three.js,Physics Engine,Physijs,我试图使用physi.js库()。我遵循给出的所有步骤: 但是,我得到了一个错误: Uncaught SecurityError: Failed to construct 'Worker': Script at 'file://172.16.159.200/js/physijs_worker.js' cannot be accessed from origin 'null'. 我试着深入研究,发现线路存在问题: this._worker = new Worker( Physijs.scrip

我试图使用physi.js库()。我遵循给出的所有步骤:

但是,我得到了一个错误:

Uncaught SecurityError: Failed to construct 'Worker': Script at 'file://172.16.159.200/js/physijs_worker.js' cannot be accessed from origin 'null'.
我试着深入研究,发现线路存在问题:

this._worker = new Worker( Physijs.scripts.worker || 'physijs_worker.js' );

是什么导致了这个问题?浏览器是谷歌浏览器。我检查过了,文件“physijs_worker.js”出现在正确的位置。

在web服务器上部署您的网站。如果没有web服务器,我也会遇到同样的错误。

浏览器不允许从本地文件创建工作进程,因为这将是一个安全问题

另见这个问题:


只需添加chrome扩展


并使用扩展名启动index.html。现在它将在localhost中运行,不会出现与post和.Sweet相关的错误。像冠军一样工作。谢谢。遗憾的是,这在macOS/使用Brave上不起作用。扩展将安装,但运行应用程序(您可以通过spotlight在中找到)会启动应用程序,但不会显示任何窗口。