Monday, April 14, 2008

Embedded Controls

Those of you on board for the ride since Web 1.0 will remember those CGI scripts, or Common Gateway Interface gizmos. The user would have to hit reload, or the Javascript would trigger it, and a new page would appear, some matrix reloaded.

Flash forward and Microsoft comes out with this ActiveX control that allows developers back door access to the browser's experience. Without making any obvious click noises, or otherwise distracting the user, the browser could update a server regarding user-triggered events, key strokes and so on. Of course such tools could be used to nefarious ends, and to this day we have controversies surrounding browser security and so on.

Nevertheless, other browsers quickly rallied around the XMLhttpResponse object (hence Web 2.0), which does what it says it does. The client stuffs XML up the pipe, or just asks for new data, with XML coming back, to be deployed within the DOM somewhere, thereby giving the user an updated view, minus any need to reload or click or do other than emulate a control panel.

For example, in throwing the I Ching, an HTML button or embedded timer loop might trigger a fetch, sending nothing except this "need a new throw" signal. The server comes back with some appropriate yadda yadda, which transcribes to the screen, pulling Chinese characters from whatever font library supporting the unicode codespace (or some other addressing scheme -- the purpose of the DOCTYPE declaration).

Those of you who already know all of the above often use the word AJAX, focusing on the asynchronous nature of the Javascripted events (plus the AX might remind us of humble ActiveX beginnings). Servers have lots on their minds and can't be guaranteed to have instantaneous response times (tcp/ip itself doesn't guarantee it), so what happens on the client side, versus the server side, is only loosely coupled. The response object signals when it's ready, has some new content.

I recommend doing some more searching if wanting more details on this subject, as it has been written up in depth by many competent AJAX developers and technical writers. I'm just supplying some overview, value added for those readers enjoying my spin on stuff.