Using client side javascript to create a Recent Blog Entries list for a Blog that is on another site

by Jason Haley 11. March 2006 09:35

Last week I outlined the steps to create this same functionality using an asp:Xml control (in case you didn't read it).

The need
Create a listing of hyperlinks for a blog that is on another site in .Net 1.1. 

The solution
Create some simple javascripts that will make the call to the rss url to get the xml file, grab the needed information out of the xml file to create a listing of links ... pretty simple right?

If you have done any client side web scripting in IE since version 5 came out years and years ago, you know that creating Dhtml scripts that do alot are pretty simple ... but if you haven't done any scripting for FireFox ... then you'll need to do a little research to get the scripts as close as possible, but still work on both browsers (I know there are other browsers out there - but I chose to ignore them in this little project).

Here are the steps to get this working:

1.  Create some variables to hold things like “Loading...”, the rss url and maybe some general error message - just in case.
2.  Create and wire up an onload event handler
3.  Create an XmlHttpRequest object (the manner is doing so varies according to the browser)
4.  Retrieve the returned Xml and parse the needed pieces into some html (this also varies depending on the browser)
5.  Update the web page to contain the html that was built in step 4.(this also varies depending on the browser)

For the complete html and scripts, the sample file is at http://jasonhaley.com/files/RecentPosts.htm

 

 

Comments (0) | Post RSSRSS comment feed |

Categories:
Tags:

Comments are closed