最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Retrieve a cross domain RSS(xml) through Javascript - Stack Overflow

programmeradmin3浏览0评论

I have seen server side proxy workarounds for retrieving rss (xmls) from cross-domains. In fact this very question addressess my same problem but gives out a different solution.

I have a constraint of do not use a proxy to retrieve rss feeds. And hence the Google AJAX Feed API solution also goes out of picture. Is there a client-only workaround for this problem.

JSONP is the solution for requests that respond with JSON output. But here, I have RSS feeds which can respond with pure xml .

How do I solve the problem.

I have seen server side proxy workarounds for retrieving rss (xmls) from cross-domains. In fact this very question addressess my same problem but gives out a different solution.

I have a constraint of do not use a proxy to retrieve rss feeds. And hence the Google AJAX Feed API solution also goes out of picture. Is there a client-only workaround for this problem.

JSONP is the solution for requests that respond with JSON output. But here, I have RSS feeds which can respond with pure xml .

How do I solve the problem.

Share Improve this question edited May 23, 2017 at 12:09 CommunityBot 11 silver badge asked Dec 3, 2009 at 5:31 AjayAjay 7,42818 gold badges59 silver badges75 bronze badges 2
  • What browsers and platforms have to be supported? – J5. Commented Dec 13, 2009 at 13:43
  • All major browsers :- IE 7+, Firefox 3+, Chrome.. – Ajay Commented Dec 14, 2009 at 10:07
Add a ment  | 

5 Answers 5

Reset to default 4

Use something like Yahoo! Pipes to serve as your proxy and translate the RSS XML into a JSON response.

Here is an article with instructions and code samples that explains how to do it: Yahoo Pipes--RSS without Server Side Scripts.

If you have control over both domains, you can try a cross-domain scripting library like EasyXDM, which wraps cross-browser quirks and provides an easy-to-use API for municating in client script between different domains using the best available mechanism for that browser (e.g. postMessage if available, other mechanisms if not).

Caveat: you need to have control over both domains in order to make it work (where "control" means you can place static files on both of them). But you don't need any server-side code changes.

Another Caveat: there are security implications here-- make sure you trust the other domain's script!

Right now there really isn't a cross-platform solution for cross-site scripting. Do you have control or access to the RSS feeds? If so, why not simply respond with JSON and use JSONP?

There are other things ing down the pike with HTML5, like cross-site messaging (referred to as Cross-Document Messaging) that may be capable of delivering a payload of XML, but last time I checked, they hadn't even fully decided on a size limit for the messaging.

You can see the spec here: http://dev.w3/html5/spec/Overview.html#crossDocumentMessages

A solution for cross-domain calls without a server-side proxy is to use a SWF ponent. You can script yourself one or use the readily available FLSend

The ponent uses ActionScript's URLRequest to call remote domains and ExternalInterface to municate with the JavaScript methods that render your content.

The only way I can think of would be to embed a signed java applet on the webpage to retrive the xml and use javascript to interface with that. I'm not even 100% certain what the java security model is for that at present though but I think it would work.

发布评论

评论列表(0)

  1. 暂无评论