I set about recently to try to get a RSS feed parsed using only Javascript. Not as easy as I had thought it would be. I had figured that there would be several Javascript library’s around, and I thought for sure that someone would have a jQuery plugin for it. Well, I did find jFeed, but it suffers from a rather large issue. It can’t access sites from a different domain from where it is running. This is really a Javascript security feature. I did a simple AJAX test, and sure enough, Javascript stops us from directly accessing another domain (to prevent cross site scripting attacks).
How do you get around this issue? Well, a php based proxy is one solution. You call via AJAX, this php file that then makes the request to the real feed, and sends it back. That didn’t seem like a simple or elegant enough solution.
I found RssToHtml, which is a PHP script that you can use the parse the RSS feed. Using this, you can even use an server side¬†include to get the feed. This¬†didn’t work on my machine¬†that would only¬†run cgi scripts from the include.¬†
I had just about given up when I stumbled upon the Google AJAX Feed Api. Google to the rescue again.
Continue reading