javascript 本地主机:来自源“null”的图像已被跨源资源共享策略阻止加载
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22213207/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Localhost: Image from origin 'null' has been blocked from loading by Cross-Origin Resource Sharing policy
提问by Lucia
I'm opening the page on two computers, both ip and localhost tried:
我在两台电脑上打开页面,ip和localhost都试过:
Strangely, for one computer, the http://192.168.1.100/dev
didn't work and http://localhost/dev
did. For the other, neither worked. It says,
奇怪的是,对于一台计算机,它http://192.168.1.100/dev
不起作用并且http://localhost/dev
确实起作用了。对于另一个,两者都不起作用。它说,
Image from origin 'null' has been blocked from loading by Cross-Origin Resource Sharing policy: Received an invalid response. Origin
'http://localhost'
is therefore not allowed access.
来自源“null”的图像已被跨源资源共享策略阻止加载:收到无效响应。
'http://localhost'
因此不允许访问Origin 。
None of the answers I found seem to work. And I don't understand why it only worked on localhost
on one computer. Any suggestions?
我找到的答案似乎都不起作用。而且我不明白为什么它只能localhost
在一台计算机上运行。有什么建议?
Edit:
编辑:
- Browser: Chrome Version 34.0.1847.11 beta
http://127.0.0.1/dev
didn't work either- The uploaded version on server didn't work either
- 浏览器:Chrome 版本 34.0.1847.11 测试版
http://127.0.0.1/dev
也没有用- 服务器上上传的版本也不起作用
采纳答案by Lucia
It turns out, it was the AdBlock
plugin that blocked the file.
事实证明,是AdBlock
插件阻止了该文件。
The name of the directory containing the blocked file was AD16
. Somehow the other AD01
, AD09
, AD22
, AD27
worked fine, but not AD16
.
包含被阻止文件的目录的名称是AD16
. 不知怎的,其他AD01
,AD09
,AD22
,AD27
工作得很好,但不是AD16
。
Disabling AdBlock
and everything works fine.
禁用AdBlock
,一切正常。
The same problem would have occurred on any chrome with the plugin on, so we changed the name of the directory to AD_16
.
任何带有插件的 chrome 都会出现同样的问题,因此我们将目录名称更改为AD_16
.