Blogger is very cool! It's just so easy to setup a nice looking site, manage your content, and tweak your template until everything is just right.
Once I decided to resurrect this blog, I looked at my templated and decided to spice things up, a bit. In particular, I really wanted to make my links dynamic, so that they would automatically reflect my current interests and areas of research. Luckily, I already have this content on del.icio.us. The question is, how can I get it to automatically update in my sidebar. Adding an RSS feed from del.icio.us was the obvious answer. You can see the results on in the sidebar, on the right side of the page.
I started by looking around Blogger for the ability to add RSS feeds to my blog from the Settings tab. Imagine the ability to go to "RSS Feeds", add a feed by entering a name, a link, and a number of items to display, and having the feed show up in a pre-determined area on my site (e.g. the sidebar). No such luck.
A quick search produced an article from AJAX Magazine about how to build an AJAX-based RSS reader, complete with sample code. Testing and fine-tuning the sample code on my local computer was a breeze and I was consuming my del.icio.us RSS feed in minutes.
However, when I plugged the AJAX code into my Blogger template and previewed the page, I received error messages... an no del.icio.us feed. What happened?
I searched again and found a great article on XML.com that outlines three approaches to working around the originating domain limitation in the XMLHttpRequest object.
- Write a proxy that runs on the originating domain that can be invoked by XMLHttpRequest (requires the ability to run scripts on the originating domain)
- Use Apache mod_proxy (requires access to the Apache httpd.conf file)
Since I already had an AJAX RSS reader and I could only access a limited set of PHP functions on my host, I chose to write a proxy that can be invoked by the XMLHttpRequest object. A few more minutes, thanks to the sample code in the article, and my del.icio.us proxy was working!