Saturday, December 18, 2004

Auto complete comes of age

If you haven't tried Google Suggest yet, click on the link right now and do so. Please. The characters at Google Labs -- who are more creative than Hunter S. Thompson on a Peyote-and-Tequila bender -- have come up with more simple, yet breakthrough technology. Simon Willison explains how it works.

Google Suggest, the latest bag of tricks from Google Labs, is a perfect example of how modern web applications are breaking out of the mold and becoming more interactive. It uses XMLHttpRequest to run queries against Google as yout type, proving an auto-complete box with the most likely results. As you might expect from Google, it's slick, intuitive and fits right in to their bare-bones interface.

The JavaScript that powers the feature is pretty well obfuscated, so if you want to see how it works your best bet is to install the Firefox/Mozilla Live HTTP Headers extension, set it up as a sidebar and watch what happens when you use the site. Basically, for every character you type it retrieves a page like this and evals the resulting string of JavaScript. It's the same kind of technique they use for Gmail.

XMLHttpRequest is a technology with amazing potential, and this is just the tip of the iceburg. The web's about to get a whole lot richer.

Simon Willison: Auto complete comes of age

Update: Jon Udell says that, while this breed of Google DHTML apps are cool, they still point out fundamental weaknesses in the browser development model. I think I said the something similar a while back, and suggested some evoluationary changes in JavaScript and DHTML.

No comments: