1

我正在构建一个 Campfire 客户端,它将在 WebOS 中运行并作为 Chrome 桌面网络应用程序运行。我有以下代码:

logIn: function(){
    this.apiToken = this.$.loginScreen.$.apiToken.getValue();
    this.subdomain = this.$.loginScreen.$.subdomain.getValue();
    this.fullURL = 'https://' + this.subdomain + '.campfirenow.com/';
    this.$.roomService.url = this.fullURL + 'rooms.json';
    var response = this.$.roomService.send({'Authorization': "Bearer " + this.apiToken, 'Access-Control-Allow-Origin': this.subdomain + '.campfirenow.com'});

'roomService' 是这样的:

{name: "roomService", kind: "enyo.WebService", url: null, onResponse: "successfulAlert", onError: "someFailure"}

在 Chromium 中,我不断收到以下 XMLHttpRequest 错误:

Origin null is not allowed by Access-Control-Allow-Origin.

有任何想法吗?

4

1 回答 1

2

您可能想看看这个 StackOverflow 问题:

XmlHttpRequest 错误:Access-Control-Allow-Origin 不允许 Origin null

您试图从 file:// URL 运行它而被阻止。

于 2012-07-17T16:02:14.417 回答