JavaScript - - By Simon Willison

A9 and Google Local

If you want proof that remote scripting has hit the mainstream, look no further than the recent launches of both Amazon’s A9.com search engine and Google’s new Google Local service. Both make extensive use of remote scripting, a technique whereby JavaScript is used to refresh content from a server without requiring a refresh of the whole page.

In Google Local’s case, the technique used is the increasingly popular XMLHttpRequest. To see it in action, try zooming or recentering the map on this results page. The JavaScript is a pretty ugly mass of browser detection scripts but it works just great in the browsers I tested it in. Meanwhile, A9.com uses an interesting variant on the old hidden iframe trick. Once the iframe document has finished loading, it calls a function to copy its own innerHTML in to a div contained in the parent window that loaded it. View source on this page for an idea of how it works.

Web applications have long been written off as inferior to native desktop applications due to the requirement of a full page refresh to load fresh data from the server, but now that techniques such as the above are becoming more widespread that criticism is losing its relevance. I don’t think we’ve even begun to scratch the surface of the possibilities that remote scripting opens up.

Sponsors
Login or Create Account to Comment
Login Create Account