1
我正在构建一个将在WebOS中运行并作为Chrome桌面Web应用程序运行的Campfire客户端。 我有以下代码:如何使用Enyo 2.0 WebService对象
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'});
的 '房间服务' 是这样的:
{name: "roomService", kind: "enyo.WebService", url: null, onResponse: "successfulAlert", onError: "someFailure"}
而在铬我不断收到以下XMLHttpRequest的错误:
Origin null is not allowed by Access-Control-Allow-Origin.
任何想法?
如果您是从服务器运行它,如果Campfire不允许通过AJAX跨站点访问其API,则可能仍会被阻止*或*用户的浏览器不支持跨站点AJAX语义。 – 2012-07-17 19:27:13
我从Chromium运行并禁用安全功能。也许我可以将一个node.js服务器嵌入到我的应用程序中并以这种方式进行调用?我宁愿只是以某种方式使用web服务。 – RedMage 2012-07-24 22:38:32