Buca Bay - Always nice

Dua tiko noqu toa loaloa, na yacana ko… laga mai…

RSS Feeds via cross domain JSON proxy

January22

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:

  1. Appjet service ends Appjet, a web based javascript application development platform, sent out an email to members today that they are closing down...
  2. 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...
  3. 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...
  4. 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...
posted under web development
2 Comments to

“RSS Feeds via cross domain JSON proxy”

  1. On March 19th, 2009 at 3:40 am zack MonsterID Icon zack Says:

    ..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

  2. On March 19th, 2010 at 6:41 am Kyle MonsterID Icon Kyle Says:

    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

Email will not be published

Website example

Your Comment:

 
Tag Cloud