Friday, August 18, 2006

Feed Reader using AJAX, DOM and JavaScript

Hi all..
This is gonna be my first Technical Post..

Lets say, that you want to write a simple RSS Feed Reader for yourself.
And you dont want to create it using any of the Server Side Web Technologies [ PHP, Servlet, ASP or ASP.NET ]

So, Lets say you want your Feed Reader to be written using only HTML and JavaScript
[ And also lets assume, that you have permissions for making XML HTTP Calls from JavaScript (AJAX) ]

If that is the case, then it goes very simple :
  • Make either a synchronous/asynchronous XML HTTP call to ur Feed URL from JavaScript
  • Get the response Text of the URL and load it in a DOM Object from JavaScript
  • Write a JS function; that parses your DOM Object in the desirable way you need and have the data which u got added to your HTML Page

So, its as simple to write a Feed Reader in minutes with just HTML and JavaScript
I thought of these things, and also implemented the same to read the Recent Blogs of BlogSpace and display their Titles in My Site . It all worked well in my System, but then when i uploaded to Geocities it alarmed with a "Permission Denied" Error, after all am using a free web host and how can i expect them to give me permissions for making Ajax calls from my Html pages.. Huh :( Got little disappointed, though..

But still wanted to share that here, so that it might be useful for some dudes around..
If u need, a sample working model of the same which i hosted in my site.
You can juz save the page of my Sites' Blogspace link and then check and try it out.

Until next post.
CIAO

[PS: Am not very sure whether i will be posting any more Technical Posts, as long as there are no Tomotoes/Stones being thrown at me for this particular post.. He he he :) ]

4 comments:

Vignesh Kumar said...

@nearfar,
:(

Deepak Vasudevan said...

@Vignesh,

Are you making cross domain calls with AJAX? I think in that case it might bump. You need a serverside handler to route calls between servers (to act as a proxy layer).

I have a couple of AJAX pages in my webpage at http://www.lavanyadeepak.tk/ and the thing is that both the host and TLD are ad supported editions. They do load fine. And the XmlHttpRequest library that is being used is from SCSS Website

Vignesh Kumar said...

@Deepak,
Thanks for ur comment..
Am making cross-domain calls, and so am not able to..
I will go through your links..

Deepak Vasudevan said...

@Vignesh,

This should be helping you:

http://developer.yahoo.com/javascript/howto-proxy.html