Web 2.0's Engine Lacks A Spec No Longer

Thomas Powell

Ajax!So if you know a bit about Ajax you might assume that there is no specification for the technology. That makes sense because Ajax is more of a term for a way of coding a JavaScript application – asynchronous communications often with XML as a payload though not always. Well it turns out that if you get to the heart of Ajax you generally find the XMLHttpRequestobject which is a Microsoft invention from nearly a decade ago. Anyway given how important this object has become it is time to actually document what it can do; enter the W3C.

The W3C is trying to figure out what XMLHttpRequestobjects (XHRs for short) are actually supposed to do. If you know the ins and outs of XHRs there won’t seem to be anything new here, but the devil is in the details as they say. It turns out when you read closely you find that browsers really aren’t conforming that well. Specific sticklers note that all the various MUST statements made in a specification should work. For example, the conforming user agent MUST support a certain number of HTTP methods, not all do. The setRequestHeader() method should not allow some headers to be changed, many browsers do. Certain exceptions must be raised by browsers, they mostly aren’t.

What is most interesting though is the specification called “Not in this Specification”. Here you get some pointers to interesting areas both supported by some browsers and actively being worked on. Some gems:

  • Timers and timeouts
  • Progress events
  • Error handlers
  • Better request header management

However, the big news is cross-site requests. Now today with an XHR you really can’t make two requests to two different sites as it breaks JavaScript’s same origin policy. If you are skeptical because you have heard so much about mash-ups understand that many of those are actually server based as far as accessing the data or rely on browser extensions like Greasemonkey. When not performing the mash-up in one of these two ways a developer must use another approach such as thescript tag work-around that Yahoo’s API use.

The implication of the cross-domain request possibility is simply fantastic because it will allow for many client-side applications to blossom quickly. But before you get cynical about all the W3C specifications that are nearly as cool that never get implemented take heart, apparently Firefox 3 is about to introduce this feature in the next week or two.

[photo under CC by flickr user erikogan]

Related Articles

Designing for Digital and Print

Having consistent messaging, look, and feel is essential to providing a seamless experience for users. Translating that across digital and print can be a challenge. ...

Rob McFarlane
By Rob McFarlane
Oct 29th, 2018

All The Tests: PINT’s Overview of Web Testing

To help you get started with testing, we’ve compiled some of the basics: Types of Tests you’ll want to consider and the concept of The Testing Pyramid. ...

Preston Resenbeck
By Preston Resenbeck
Sep 18th, 2018

Tell us about your project

Please fill out your information and submit