The new Google Suggest function provides autocomplete for web searches. Start typing and, before you’ve quite decided what you’re looking for, Google politely offers a list of possibilities. Convenient. Slightly unsettling. Welcome to the future.
Underneath, it’s actually fairly straightforward stuff. Some condensed JavaScript disables the browser’s own autocomplete and creates a hidden div element. As you type, that div is continuously populated with suggestions matching whatever collection of characters you’ve managed to produce so far.
The interesting part is the speed. It’s far too quick to be doing a traditional full Google search and postback for every keystroke. My guess is that Google keeps a cached list of popular searches and uses XMLHttpRequest to fetch the suggestions quietly in the background.
No page reload. No submit button. No waiting around staring at a blank browser while the server contemplates its existence. The page simply changes while you’re using it. That may not sound particularly revolutionary, but it feels different. The web page is starting to behave less like a document and more like an application.
I suspect this will not be the last time we see this technique.
Update: The technique was named Ajax by Jesse James Garrett in February 2005. Because nothing truly exists in the technology industry until somebody gives it a catchy name.
Comments
No comments yet.
Leave a reply