Patrick Dwyer


Building Interaction - Web Apps with XMLHttpRequest

in Perl, JavaScript, RSS by patrick

Using the web (specifically browsers) as an application development platform has faced a great number of hurdles, and after many successes and failures of implementation and technology only a few stumbling blocks remain before web delivered software becomes usable (in a traditional application sense), and a sturdy replacement for client side desktop applications.

One of these hurdles is interactivity. The problem lies in the need for web pages to refresh to show changes in data. The act of contacting the server, recreating interface logic and data logic, processing input, maintaining interaction state, and sending data back is time consuming on a processing and transport layer. The longer it takes to process, the more the flow of work is broken for the user. Various technologies try to address this problem of content and interaction. Flash and Shockwave come immediately to mind, with Java Applets and ActiveX trailing behind.

While these plugin based solutions have matured to the point of usability for the average user (and the average computer), for many reasons they can be sub-optimal solutions. Most applications written in these tools can’t interact with the user and browser as a traditional web page can. The ability to copy, paste, and print are lost, as well as the interface mechanics we’re used too with a standard webpage.

One HTML (rather XML and Javascript) based solution that has gained in popularity, as more of the Internet using population adopt browsers with the supporting features, is using the XMLHttpRequest object in JavaScript to initiate communications with the server from a webpage, without reloading content. A JavaScript can simply request data from the server, and receive the data without the browser needing to reload the surrounding HTML.

A few high profile sites have begun using XMLHttpRequest based interfaces, most notably Google Suggest. This technique allows interactions taken by the user to trigger javascript, which in turn requests data from the server. This data is received by a javascript function, where it can be parsed and placed into existing structures on the page.

Why bring this up? I’ve whipped up a proof-of-concept RSS News Reader based on this technique. WebRSS can download and parse basic RSS2.0 news feeds, allowing RSS browsing from a web interface. While not a highly technical application, it does demonstrate the interaction possibilities opened up by XMLHttpRequest.

Images and RSS

in Perl, RSS by patrick

I’ve begun work on a number of RSS related snippits of code for various projects, and in doing so have played with a few ways to speed up RSS production, as well as interesting applications.

For RSS creation (at least from a perl backend) I would highly recommend the XML::RSS module. It supports a variety of RSS formats, and certainly eases the time it takes to whip up a quick feed.

But on to the interesting applications. If your RSS Aggregator (Try NetNewsWire if you’re on a Mac) supports images, try out Google Image Feed. Just enter a few search terms, copy the resulting RSS link into your news reader, and you’ve got a RSS Channel of images, taken from the Google Images search engine. Nothing terribly new here, but a fun experiment with RSS and Images.