Javascript RSS Generator

Updated 9/22/2005. Here’s an interesting bit of confluence: A site called “RSS to JavaScript” is using some off-domain JavaScript + an RSS parser to let users imbed a feed within their own HTML pages.

The technique is straight forward:

1) You include a scriptlet in your HTML like this:

<script language=”JavaScript” src= “http://www.globalsyndication.com//rss2js/feed2js.php?src= http%3A%2F%2Finkblots.markwoodman.com%2Ffeed%2Frss2&chan=y&num=5&desc=200&date=n&targ=y&html=a” type= “text/javascript”></script>

2) When your page is loaded in a browser, it tries to include the off-site javascript file located on globalsyndication.com into the page. The url isn’t actually a .js file but rather a php that reads the RSS feed specified in the URL parameters (src=http….), and then generates a series of javascript document.write() lines.

3) The browser renders the document.writes into HTML, and voila:

For people who want to include an RSS feed block in their web page without the need for scripting, php support, or what have you, this might come in handy. What you don’t get, however, is much control over the style of the output. (You had better also hope they don’t ever decide to include advertisements in there. ) Still, not bad for free.

Comments are closed.