【发布时间】:2016-05-13 17:35:58
【问题描述】:
我正在 Visual Studio 2015 中开发一些 Apache Cordova 应用程序,并使用 Ripple Emulator 对其进行测试。
几天后,我与服务器的连接不再起作用。
我收到以下错误。
XMLHttpRequest 无法加载 http://xxxxx。对预检请求的响应 未通过访问控制检查:没有“Access-Control-Allow-Origin” 请求的资源上存在标头。起源 'http://localhost:4400' 因此不允许访问。响应 有 HTTP 状态码 401。
基于stackoverflow中的其他问题,我尝试将跨域代理更改为远程或本地,但没有成功。
我还将<access origin="*" /> 添加到我的config.xml 中
<?xml version="1.0" encoding="utf-8"?>
<widget xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps" id="io.cordova.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" defaultlocale="de-AT">
<content src="index.html" />
<access origin="*" />
....
如果我使用参数 --disable-web-security 启动一个新的 chrome-window,它就可以工作。 (但在新的 chrome-window 中,我无法使用 Visual Studio 进行调试。)
【问题讨论】:
标签: android cordova visual-studio-2015 cross-domain ripple