Blog

Web 2.0's Engine Lacks A Spec No Longer

Web 2.0’s Engine Lacks A Spec No Longer

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 XMLHttpRequest object 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 XMLHttpRequest objects (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

Technical

Accessibility on the Modern Web

There’s been a lot of buzz in the news lately about accessibility, specifically in reference to the dozens of ADA lawsuits that seem to be more and more...

Technical

Automated Visual Regression Testing

What is automated visual regression testing? The name sounds scary, but in reality, the idea is fairly simple. If you have a user interface (UI),...

Technical

Automated Testing Tool Comparisons

Automated testing is rapidly gaining popularity across the web development field, and as expected, the number of automated testing tools is growing rapidly as well....