Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve a cross domain RSS(xml) through Javascript

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.

like image 835
Ajay Avatar asked Dec 03 '09 05:12

Ajay


2 Answers

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.

like image 70
Mads Hansen Avatar answered Nov 10 '22 10:11

Mads Hansen


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 communicating 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!

like image 35
Justin Grant Avatar answered Nov 10 '22 10:11

Justin Grant