views:

428

answers:

5

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.

A: 

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 coming 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.org/html5/spec/Overview.html#crossDocumentMessages

Dustin Hansen
To answer your first question, No, I dont have a control over the feed. Feeds are everywhere!
Ajay
They are?! /sarcasm. ;) It was worth asking in the off-chance you were in control of the feed you were retrieving.
Dustin Hansen
+1  A: 

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.

Mads Hansen
yahoo pipes... thats a NO cos, i have internal feeds!! :(
Ajay
I think for your internal feeds, you'll have to use a proxy.
J5
A: 

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

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

Razvan Caliman
You still can't retrieve data from another server though unless the crossdomain.xml file on there allows access so it's not a general solution.
John Burton
A: 

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.

John Burton
A: 

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!

Justin Grant