RSS Feeds via cross domain JSON proxy
JavaScript remoting functions are limited to the same domain. For example, XMLHttpRequest can only retrieve URLs on the same domain, and the same applies for the Flash remoting methods.
JavaScript files however, can be hosted on a different domain, and this is the basis of a well known JavaScript remoting method.
To retrieve RSS feeds, you don’t need a proxy on the same domain.
You can actually have a proxy on a different domain, but have that proxy create a JavaScript file of the RSS XML text.
That is, encapsulate the RSS XML text in a JavaScript variable or function.
That way you can include the RSS as a JavaScript file.
For example, the yahoo top stories:
http://rss.news.yahoo.com/rss/topstories
Could be proxied as:
http://json-proxy.appjet.net/?url=http://rss.news.yahoo.com/rss/topstories
And retrieved via a simple <script> tag:
<script src="http://json-proxy.appjet.net/?url=http://rss.news.yahoo.com/rss/topstories"></script>
And recieved in JavaScript as:
function callback(rss) {
// manipular rss here..
}
I’ve written a JavaScript class that will do the heavy lifting, and allow you to retrieve RSS feeds cross-domain from within JavaScript.
You can view the JavaScript source at the project page.
I’m using this JavaScript class to power the images at the top of my blog. They are retrieved from a Flickr RSS feed via JavaScript, with no server side interaction on my domain - just the JSON proxy at Appjet.
Update: 25th Sept, 2009
Appjet has closed down. The JSON/RSS proxy now resides at: http://json-proxy.jgate.de/
So the URL to proxy any webpage would be: http://json-proxy.jgate.de/?url={url}
The JavaScript RSS Proxy library has been updated to reflect this.
Related posts:
- Appjet service ends Appjet, a web based javascript application development platform, sent out an email to members today that they are closing down...
- Google AJAX Language API with PHP I had noticed some time ago that Google had released an API for their language translation service. A recent forum...
- Get Satisfaction and W3C Compliance We recently have tried using Get Satisfaction to complement our support efforts at Fiji Web Design. It is a very...
- Backup and export Appjet Applications Appjet recently anounced that they are closing down. They however offer an open source download that allows you to run the...
..just stumbled across your site - I really like the design! great work :o)
also a nice cross-domain RSS solution … I’ll be giving that a try myself!!
regards
zack
Great site; helpful info and looks good too. Keep it up!
I’m wondering if there are other proxies that can be used as alternatives to the one from Germany…??
Kyle