3

我想将一个 Web 应用程序从 PhoneGap 带到 PC 浏览器,只是因为我需要做一些测试。在 WebApp 内部,有一些 XMLHttpRequest 失败,因为 Header 来源为空。

我已经尝试使用以下命令运行 C​​hrome:

chromium-browser index.html  --allow-file-access-from-files

我有同样的错误:

Origin file:// is not allowed by Access-Control-Allow-Origin.

我不明白为什么使用 android 模拟器一切正常。phonegap 还加载本地文件:

super.loadUrl("file:///android_asset/www/index.html", 1);

或多或少我已经解决了这个添加在 Firefox !

它可能对其他人有用:

Firefox 附加组件 Force CORS

4

1 回答 1

0

在启动 chromium 时尝试使用此标志--disable-web-security 。显然,它仅用于开发目的。

于 2012-05-14T01:17:57.663 回答