(转)XMLHttpRequest在请求失败(Origin null is not allowed by Access-Control-Allow-Origin.)
2013-01-17 20:09
841 查看
在学习XMLHttpRequest的使用过程中,使用chrome打开任意空网页,在控制台下输入如下代码
报错部分的英文的大概意思就是不允许跨域,至于什么叫做不允许跨域呢?
这里推荐一个博文,简单的解释了一下跨域/article/3514629.html
我尝试了chrome、firfox、opera都出现了这种情况,但是使用IE8就不会出现这种错误,很多人不是很理解。
这里Windows help and support 做出了解释 IE本身也并不是允许跨域的因为这样很不安全,但是如果不跨域的话又带来很多不便,所以会让你手动的选择一下是否允许跨域。而chrome、firfox、opera则默认就是不允许。
1 var oHttp=new XMLHttpRequest(); 2 undefined 3 oHttp.open('GET','http://www.baidu.com/') 4 undefined 5 oHttp.send(); 6 undefined 7 XMLHttpRequest cannot load http://www.baidu.com/. Origin null is not allowed by Access-Control-Allow-Origin.
报错部分的英文的大概意思就是不允许跨域,至于什么叫做不允许跨域呢?
这里推荐一个博文,简单的解释了一下跨域/article/3514629.html
我尝试了chrome、firfox、opera都出现了这种情况,但是使用IE8就不会出现这种错误,很多人不是很理解。
这里Windows help and support 做出了解释 IE本身也并不是允许跨域的因为这样很不安全,但是如果不跨域的话又带来很多不便,所以会让你手动的选择一下是否允许跨域。而chrome、firfox、opera则默认就是不允许。
What is active content and why does Internet Explorer restrict it?
Active content is interactive or animated content used on websites. It includes ActiveX controls and web browser add-ons, which are small programs that are used extensively on the Internet. Active content can make web browsing more enjoyable by providing toolbars, stock tickers, video, animated content, and more.Why does Internet Explorer restrict active content?
Internet Explorer restricts this content because occasionally these programs can malfunction or give you content you don't want. In some cases, these programs can be used to collect information about you, damage information on your computer, install software without your consent, or allow someone else to control your computer remotely. Given these risks, you should allow active content only if you completely trust the publisher or the website it's coming from.How can I allow active content?
If Internet Explorer restricts active content that you are sure you want to allow, click the gold Information bar that appears at the top of the webpage, and then click Allow blocked content. For more information, see Internet Explorer Information bar: frequently asked questions.相关文章推荐
- XMLHttpRequest在请求失败(Origin null is not allowed by Access-Control-Allow-Origin.)
- XMLHttpRequest在请求失败(Origin null is not allowed by Access-Control-Allow-Origin.)
- jquey XMLHttpRequest cannot load url.Origin null is not allowed by Access-Control-Allow-Origin
- XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin
- XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin
- XMLHttpRequest cannot load – Origin is not allowed by Access-Control-Allow-Origin.
- XMLHttpRequest cannot load – Origin is not allowed by Access-Control-Allow-Origin.
- Chrome下解决本地异步请求失败的问题(Origin null is not allowed by Access-Control-Allow-Origin. )
- XMLHttpRequest cannot load – Origin is not allowed by Access-Control-Allow-Origin.
- XMLHttpRequest cannot load – Origin is not allowed by Access-Control-Allow-Origin.
- XmlHttpRequesterror:OriginnullisnotallowedbyAccess-Control-Allow-Origin
- XMLHttpRequest cannot load – Origin is not allowed by Access-Control-Allow-Origin.
- Error :Request header field Content-Type is not allowed by Access-Control-Allow-Headers post请求失败原因
- chrome发起跨域ajax请求遇到 Origin null is not allowed by Access-Control-Allow-Origin 一解
- 使用chrome调试ajax加载本地文件的时候出现Failed to load resource: Origin null is not allowed by Access-Control-Allow
- Origin null is not allowed by Access-Control-Allow-Origin
- Chrome浏览器报错:Origin null is not allowed by Access-Control-Allow-Origin.
- Origin null is not allowed by Access-Control-Allow-Origin
- 关于chrome浏览器下使用js读取本地json文件时提示“Origin null is not allowed by Access-Control-Allow-Origin”问题
- jquery跨域报错:Origin null is not allowed by Access Control Allow Origin