XMLHttpRequest在请求失败(Origin null is not allowed by Acces
在学习XMLHttpRequest的使用过程中,使用chrome打开任意空网页,在控制台下输入如下代码 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 l
在学习XMLHttpRequest的使用过程中,使用chrome打开任意空网页,在控制台下输入如下代码
<span>1</span> <span>var</span> oHttp=<span>new</span><span> XMLHttpRequest(); </span><span>2</span> <span>undefined </span><span>3</span> oHttp.open('GET','http://www.baidu.com/'<span>) </span><span>4</span> <span>undefined </span><span>5</span> <span>oHttp.send(); </span><span>6</span> <span>undefined </span><span>7</span> XMLHttpRequest cannot load http:<span>//</span><span>www.baidu.com/. Origin null is not allowed by Access-Control-Allow-Origin.<br></span>
报错部分的英文的大概意思就是不允许跨域,至于什么叫做不允许跨域呢?
这里推荐一个博文,简单的解释了一下跨域http://my.oschina.net/LinBandit/blog/33160
我尝试了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.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











What does Origin do? Origin is the platform you need to be able to play most Electronic Arts games on a Windows 11 PC. The platform has been around for a long time and it offers a variety of other games that you can buy and play. But it also has other useful features, such as the ability to chat with friends and earn achievements for the games you play. Definitely worth a try. Along with Steam and Epic Games, it's one of the many game launchers your Windows computer can access. EA Play is the solution for those who want to have a large selection of different games to choose from and enjoy them without having to purchase each one. Nature

Users usually upgrade the computer system version to fix some problems. If the user fails to update to the latest version of 23H2 using win11 system, there are three methods to solve your problem. What to do if Win11 update 23H2 fails. Method 1: Bypass TPM1, click "File Explorer - View", and check the "Hidden Items" option in the drop-down menu. 2. Go to and delete "C:\$WINDOWS.~BT\Sources\Panther-Appraiser_Data.ini". 3. Then re-create a folder with the same name in this location, and then click to cancel the "Hide Items" option. 4. Re-update the system and finally click on “Wind

Why does storing data to localstorage always fail? Need specific code examples In front-end development, we often need to store data on the browser side to improve user experience and facilitate subsequent data access. Localstorage is a technology provided by HTML5 for client-side data storage. It provides a simple way to store data and maintain data persistence after the page is refreshed or closed. However, when we use localstorage for data storage, sometimes

If the operating system we use is win7, some friends may fail to upgrade from win7 to win10 when upgrading. The editor thinks we can try upgrading again to see if it can solve the problem. Let’s take a look at what the editor did for details~ What to do if win7 fails to upgrade to win10. Method 1: 1. It is recommended to download a driver first to evaluate whether your computer can be upgraded to Win10. 2. Then use the driver test after upgrading. Check if there are any driver abnormalities, and then fix them with one click. Method 2: 1. Delete all files under C:\Windows\SoftwareDistribution\Download. 2.win+R run "wuauclt.e

Vue is a popular JavaScript framework for building modern web applications. When developing applications using Vue, you often need to interact with different APIs, which are often located on different servers. Due to cross-domain security policy restrictions, when a Vue application is running on one domain name, it cannot communicate directly with the API on another domain name. This article will introduce several methods for making cross-domain requests in Vue. 1. Use a proxy A common cross-domain solution is to use a proxy

What should I do if pip update fails? Recently, while developing in Python, I encountered some problems with pip update failure. When developing, we often need to use pip to install, upgrade and remove Python third-party libraries. The failure of pip update will seriously affect our development work. This article will discuss some common pip update failures and provide solutions, hoping to help developers who encounter similar problems. First, when we execute pipinstall-

In Linux systems, the SSH (SecureShell) service is a very important tool for remotely connecting to the server and performing management operations. But sometimes, we may encounter a situation where the SSH service fails to start, which may result in the inability to connect to the server remotely. In this case, we need to take some measures to solve the problem. This article will introduce how to handle the failure to start the SSH service in Linux systems, and provide some specific code examples to help you solve this problem. 1. Confirm

How to use context to implement request retry strategy in Go Introduction: When building a distributed system, network requests will inevitably encounter some failures. In order to ensure the reliability and stability of the system, we usually use a retry strategy to handle these failed requests to increase the success rate of the request. In the Go language, we can use the context package to implement the request retry strategy. This article will introduce how to use the context package in Go to implement a request retry strategy, with code examples. 1. What is
