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.