简体   繁体   English

qooxdoo:Access-Control-Allow-Origin不允许XMLHttpRequest Origin null

[英]qooxdoo : XMLHttpRequest Origin null is not allowed by Access-Control-Allow-Origin

I have a qooxdoo project that fetches JSON from an online server using the following codes: 我有一个qooxdoo项目,该项目使用以下代码从在线服务器中获取JSON:

var url = "http://www.example.com/json.php?q=parameter_here";
var store = new qx.data.store.Json(url,"GET", "text/plain");
store.addListener("changeModel", function(ev) {
    console.log("changeModel()");
    console.log("getData", ev.getData());
});
store.addListener("error", function(ev) {
        console.log("error", ev.getData());
    });
    store.addListener("changeState", function(ev) {
    console.log("state", ev.getData());
});

I'm using iMac, and the local path is /Users/SomeUser/Path/To/index.html 我正在使用iMac,本地路径为/Users/SomeUser/Path/To/index.html

I tried to load the index.html in Chrome browser as usual, but failed, as Chrome blocks the Javascript as Origin null is not allowed by Access-Control-Allow-Origin . 我试图像往常一样在Chrome浏览器中加载index.html ,但是失败了,因为Chrome阻止了Javascript,因为Origin null is not allowed by Access-Control-Allow-Origin After I read the answer from this question , I know I have to host it in a web server. 阅读此问题的答案后,我知道必须将其托管在Web服务器中。 Therefore I set up a XAMPP for this site. 因此,我为此站点设置了XAMPP。

Since my XAMPP has few existing Alias, I add a new Alias for this site, as follow: 由于XAMPP现有的别名很少,因此我为此站点添加了一个新的别名,如下所示:

<Directory "/Users/SomeUser/Path/To">
        Options All
        AllowOverride All
        Require local
        Order allow,deny
        Allow from all
</Directory>
Alias /myalias "/Users/SomeUser/Path/To"

When I set up the Alias like this, 403 Forbidden is reported. 当我这样设置Alias时,报告了403 Forbidden。 Then, I found this question on SO, but the answers didn't help. 然后,我在SO上找到了这个问题 ,但是答案没有帮助。 Still 403 Forbidden. 仍然是403禁止。

My goal is to load the site in local XAMPP server. 我的目标是将站点加载到本地XAMPP服务器中。 What did I miss? 我错过了什么? When I upload the folder to a web server online, it works fine. 当我将文件夹在线上传到Web服务器时,它可以正常工作。

In XAMPP Apache error_log , it shows: 在XAMPP Apache error_log ,它显示:

[Fri Apr 19 17:51:09 2013] [error] [client 127.0.0.1] (13)Permission denied: access to /myalias/index.html denied [2013年4月19日星期五17:51:09] [错误] [客户端127.0.0.1](13)权限被拒绝:拒绝访问/myalias/index.html

For the file, its permission is: 对于文件,其许可为:

drwxr-xrwx  7 SomeUser  staff  238 Apr  2 16:48 .

Note: I don't want to change the Chrome launch options to override the Access-Control-Allow-Origin policy. 注意:我不想更改Chrome启动选项以覆盖Access-Control-Allow-Origin策略。

您的确意识到,您所要做的就是转到xampp / mamp安装文件夹,找到htdocs文件夹,并在其中创建带有项目的新文件夹(例如测试),然后在浏览器中访问它,例如: http://localhost/test/对吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Access-Control-Allow-Origin 不允许 XMLHttpRequest - XMLHttpRequest is not allowed by Access-Control-Allow-Origin Access-Control-Allow-Origin不允许使用Chrome Origin null - Chrome Origin null is not allowed by Access-Control-Allow-Origin XMLHttpRequest 无法加载。 Access-Control-Allow-Origin 不允许 Origin http://localhost:63342 - XMLHttpRequest cannot load . Origin http://localhost:63342 is not allowed by Access-Control-Allow-Origin Phonegap请求的资源上没有“Access-Control-Allow-Origin”标头。 因此不允许原点&#39;null&#39;访问 - Phonegap No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access php原点是Access-Control-Allow-Origin所不允许的 - php Origin is not allowed by Access-Control-Allow-Origin XMLHttpRequest 无法加载 url 并且我的域不允许 Access-Control-Allow-Origin - XMLHttpRequest cannot load url and my domain not allowed by Access-Control-Allow-Origin 请求标头字段不允许Access-Control-Allow-Origin - Request header field Access-Control-Allow-Origin is not allowed Chrome扩展程序-Access-Control-Allow-Origin不允许使用 - Chrome Extension - Not allowed by Access-Control-Allow-Origin Access-Control-Allow-Origin不允许使用Origin null。 - Origin null is not allowed by Access-Control-Allow-Origin. 跨域 XMLHttpRequest、Access-Control-Allow-Origin 标头和 $_SERVER[&#39;HTTP_ORIGIN&#39;] - Cross-domain XMLHttpRequest, Access-Control-Allow-Origin header and $_SERVER['HTTP_ORIGIN']
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM