admin管理员组文章数量:1395151
The JavaScript code below is not loading, in the JavaScript console it says,
"Not allowed to load local resource:"
Javascript:
(function () {
var script = document.createElement('script');
script.setAttribute('src','file:///home/chronos/u-1dd073c6b7b8430c0010c7429b07db331325c324/Downloads/Core/tube.js');
document.body.appendChild(script);
}()
);
The JavaScript code below is not loading, in the JavaScript console it says,
"Not allowed to load local resource:"
Javascript:
(function () {
var script = document.createElement('script');
script.setAttribute('src','file:///home/chronos/u-1dd073c6b7b8430c0010c7429b07db331325c324/Downloads/Core/tube.js');
document.body.appendChild(script);
}()
);
Share
Improve this question
edited May 14, 2016 at 6:26
rajthakur
4536 silver badges16 bronze badges
asked May 14, 2016 at 5:59
Eddie Costa DominguesEddie Costa Domingues
351 gold badge1 silver badge6 bronze badges
2 Answers
Reset to default 2This stuff is mostly pasted from other questions but perhaps you will find it useful:
Check if your host is fully qualified in here
You can also read a guide in here
Some browsers, like modern versions of Chrome, will even refuse to cross from the http protocol to the file protocol. Chrome and Safari seem to use a more strict implementation of sandboxing (for security reasons) than the other two.
Finally, you shouldn't load javascript files off a local filesystem. You need to have it hosted with your app and load it off the web server.
Create a python server using
python3 -m http.server 8086
and replace the
file:///<PATH_TO_FILE>
with https://localhost:8086/<RELATIVE_PATH_TO_FILE>
版权声明:本文标题:javascript - js file not loading js console say's "Not allowed to load local resource" - Stack Overflo 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744745521a2622852.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论