RealTime IT News

Google: AJAX is All About Abusing Standards

NEW YORK -- If there is one application that propelled the term AJAX  into the mainstream it is Google Maps.

Before Google Maps, the Internet world was a flat place without dragable maps and without online mailboxes that looked like their desktop counterparts.

Google project manager Bret Taylor said AJAX has become a mainstream development approach since he and his team rolled out the first AJAX version of Google Maps in 2005, with sites big and small implementing the technology.

"AJAX has revolutionized the way people expect Web applications to behave," Taylor told a capacity crowd at the AjaxWorld conference here. "Users now expect the same level of interactivity as the desktop."

Two years ago, a WSDL  would have been necessary to enable mash-ups; today, using AJAX-friendly APIs, a developer can embed a Google map with just three lines of JavaScript.

What, besides Google Maps, helped AJAX use grow?

Taylor argued that it wasn't standards, as most people might think. After all, HTTP, CSS, JavaScript, XML and DOM (document object model) were all kicking around at the time and had not changed in years.

"AJAX is not defined by standards but by abusing standards," Taylor boldly proclaimed.

DOM, for example, which is supposed to be about documents, is "abused" in Google Maps because it does something it was never intended to do with graphics: cross host communication. This, Taylor explained, is achieved by abusing the JavaScript script tag injection feature.

"We dynamically inject new script tags into the DOM, which encodes the response as JavaScript," Taylor explained.

XML over HTTP (XHR) requests, a key transport element for AJAX, enables the application to get data back without doing a page refresh. XHR isn't a codified standard by the World Wide Web Consortium but is just a standard practice first used by Internet Explorer and now by all other major browsers.

"We are using standards, but what we're really using is the way the browser implements the standards and the way the browser behaves and then we're coding right around that," Taylor said.

In 2005, all Web browsers plateaued in terms of how they implemented their behaviors, so much so that Taylor said they were close to uniform.

So how did Taylor and his team figure out how to get things to work? Taylor noted that a lot of time was spent reading blog posts about what other people were doing.

Even with Google's efforts and even with the abuse of standards, Taylor noted that there are still a number of issues with AJAX, including memory usage, printing, graphics, performance and offline usage.

"AJAX as a platform is a set of technologies that was developed a long time ago for different purposes and is now evolving to accommodate new use cases," Taylor said. "But right now it is a very fragile set of technologies."

"That said, it is the best deployment option available today and that's why Google has invested so heavily in AJAX," Taylor added.