Using Javascript to display RSS

Using Javascript to display RSS

I have written about using Javascript to display RSS previously. It seems people are still interested in the subject so I thought I would revisit the subject.

Javascript and RSS

First of I need to let you know that Javascript and RSS cannot be used exclusively to display a feed on your site. The reason for this is that the RSS feed needs to be parsed which involves extracting the data from the feed.

This means that a third language needs to be used such as PHP which requires a server to run the code. Javascript on the other hand is processed by your web browser. For this reason Javascript as a tool for displaying an RSS feed is considered a poor substitute for server side RSS processing using a language such as PHP

Javascript if you insist

On the plus side Javascript options for displaying RSS on your site are a quick and simple option. The reason for this is because someone else has done the hard work already.

First of all you will need to find a service that has done this hard work, here are sites that offer RSS to Javascript processing.

The process is pretty simple, just let them know the RSS feed and the display options. You will then need to copy some Javascript that you will need to paste into your site and there you have your feed.

Benefits and cost

Whilst displaying an RSS feed on your site will provide you with some content and therefore some stickiness there are some downsides. You will be dependant on the service you have chosen being around, there will be downtime and the site may disappear altogether. You will not get and Search engine benefits as they cannot yet crawl Javascript.

Alternative to Javascript

If you prefer a more flexible and beneficial alternative the you could use PHP to parse and display your RSS feed. You will need some PHP knowledge for this but it is worth the effort.

SimplePie offers a free PHP class that does most of the hard work for you making it relatively easy to use your own web server to display RSS feeds. There are other more established alternatives such as Magpie and Carp but SimplePie offers good documentation and clear instructions.

Source from :http://www.newsniche.com/using-javascript-to-display-rss.php

posted @ 2011-02-25 18:40  李克华  阅读(334)  评论(0编辑  收藏  举报