开发者

XMLHttpRequest error: Origin not allowed by Access-Control-Allow-Origin

Basically I want to create an AddOn for Firefox which will fetch only RSS feeds from particular website. But I am getting an error:

XMLHttpRequest cannot load http://www.-** Origin http://localhost:59382 is not allowed by Access-Control-Allow-Origin.

Can anyone e开发者_如何学运维xplain how to resolve this error?


Same-origin policy applies to web content, but cross-domain requests are possible in FF add-ons. See here and here for two ways of accomplishing this.

p.s.: If you are interested, there are some nifty ways to do cross-site requests in plain old sites, using YQL (yahoo query language) (and here) and even CSSHttpRequest (I haven't tried the latter, but I've seen some cool demos).


it's the classic cross-origin problem. You migth want to read this article too.

Good Luck


You can't use the normal xhr from one domain to another. You need to use the new XHR or the one speciall made for addons. If you're on GM, it's the one starting with GM_*

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜