XMLHttpRequest failed in the request (origin null is not allowed by access-control-allow-origin .)

Source: Internet
Author: User

When learning how to use XMLHttpRequest, use chrome to open any blank web page and enter the following code in the console:

1 var oHttp=new XMLHttpRequest();2 undefined3 oHttp.open('GET','http://www.baidu.com/')4 undefined5 oHttp.send();6 undefined7 XMLHttpRequest cannot load http://www.baidu.com/. Origin null is not allowed by Access-Control-Allow-Origin.

Cross-origin is not allowed. What is cross-origin not allowed?

Here we recommend a blog, a simple explanation of the Cross-origin http://my.oschina.net/LinBandit/blog/33160

I tried chrome, firfox, and opera, but IE8 won't make this mistake. Many people don't quite understand it.

Here, Windows Help and Support explains that IE itself is not allowed to cross-origin because it is not safe, but it brings a lot of inconvenience if it is not cross-origin, therefore, you can manually select whether to allow cross-origin. Chrome, firfox, and opera are not allowed by default.

What is active content and why does Internet Explorer restrict it?

Active Content is interactive or animated content used on websites. it controls des 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 shoshould 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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.