Apple and Ajax
I just read John Gruber’s typically well-thought-out summary of the the MacWorld Expo. One thing he said struck me as a little strange, though. Talking about the differences between what iWeb can publish to .Mac vs. to a static folder, he writes:
The slideshow feature for sets of photos uses an entirely different implementation when you publish to a folder, because the fancier .Mac version relies on Ajax, which in turn relies on server software that only runs on .Mac. This isn’t a complaint — it wouldn’t be possible for Apple to create an Ajax-powered slideshow that could run on any arbitrary server.
Hmm, is that so? Does Ajax really require a specialized server backend? Not according to my understanding. Ajax describes the way a browser communicates with a web server, without saying anything about the way the web server is handling requests. You can even play with Ajax on your local hard drive, loading pages from file:// URLs.
So I was curious what Apple was doing with Ajax that made their slideshow only work on .Mac. I took a look at the source of Gruber’s example slideshow (click the “Start Slideshow” link to get the actual slideshow window, which I’m not linking to directly because it resizes your browser). Doesn’t look too complicated - a couple of javascript files, and initilization code with the full URLs of every single image. Nothing you need a specialized server for so far.
Next, I copied the code of his slideshow onto this page on fettig.net, and edited the initialization code to load some images from my flickr account. The result was a slideshow that works - mostly. The images load, the slideshow plays back fine, and the navigation controls work as expected. But instead of having a reflected version underneath each image, you get a squished version of the image iteself. And the thumbnails at the top of the page aren’t scaled as nicely. The .Mac javascript appends special arguments to the end of image URLs - (transform=reflect and transform=mini) expecting the server to serve up altered versions of those images. But since it’s just a normal static server, it doesn’t, so you don’t get the reflection/thumbnail images in the page.
So there is a special web application running at .Mac to facilitate these slideshows. It is not, however, doing anything special related to Ajax. The .Mac servers are doing two things: serving static files, and serving transformed versions of images. But those transformations could have just as easily been done in advance by iWeb itself while it was generating the slideshow. Or they could have done client-side reflection effects in the latest browsers, while degrading gracefully in older browsers. So there’s no technical reason why Apple couldn’t have made the fancier Ajax slideshow work from a static directory.
The logical conclusion is that Apple wants to encourage people to sign up for .Mac, so they make the content on .Mac look better. I don’t have a problem with that, and there are likely other reasons why iWeb is going to be at its best when matched with a .Mac account. But it doesn’t have anything to do with Ajax.