AJAX: Born of the WEB2
The long way from static pages to web applications
or
How important is to give a technology the right name
Jiří Znamenáček
Static pages with hyperlinks
First pages were simple and static. The main (and greatest) novelty were hyperlinks instructing the server to simply return the linked source.
(client requests the linked page - server responses with the requested page - client displays the returned page)
Active pages with forms
Later came FORMs. Pages returned from the server depended on the data filled in the form.
(client sends form data - server parses data and returns the page according to them - client displays the returned page)
FRAME&script based "live" solutions
Even later came ECMAScript and various new advanced techniques for retrieval of data from the server and displaying it to the user.
(client sends form data in the hidden frame - server responses to sent data by returning page to the frame - client parses data in the frame and displays them in the main page via DOM manipulation)
1997 - XMLHttpRequest is born...
Microsoft facing one of their greatest threats ever quickly creates IE 3&4&5 and puts Netscape into dust. Some of the achievements of this era are not surpassed until today.
- Pure scripting solution, build as ActiveX extension
(client builds server request in JScript object - server responses to request - client parses response in JScript object and displays output to the main page via DOM manipulation)
...but the world missed it
Browser wars were hot topic but only IE could do such "magic". And once the wars were over and IE had wone the web, Microsoft realised that this powerful and free technology could easily destroy its market with rich clients for Windows. So technology was put on hiatus and never promoted.
Few people used it for web, others for intranet applications only. But everything was tight to IE and so to the Windows platform.
2005 - AJAX is (re)born
- More than one browser with enough power
- Several higher profile web applications (eg. Google maps)
- Brand new name for 8 years old technology (invented by Jesse James Garrett) - Asynchronous JavaScript And XML
- Hype is starting (and still not slowing down)
Modern approach to "live" pages
-
XMLHttpRequest
Pure scripting solution, completely separated client and server processing, but requieres modern browsers.
-
hidden IFRAME
Scripting still needed but can work in browsers not supporting XMLHttpRequest.
XMLHttpRequest
- XMLHttpRequest() object as ECMAScript enhacement (IE7 adoptes this path too)
- script driven GET and POST requests to the server
- response can be text, XML and binary data
hidden IFRAME
- POST requests to the server
- response is ideally ECMAScript object(s) in simple HTML page
- objects of hidden IFRAME can be accessed by almost all browsers (unlike XMLHttpRequest which is limited to 21st century browsers)
Strengths
- less data sending over the net
- no need to reload the page to view results of some action
- could be crossplatform and cheaper than complete server solutions
- may feel more natural, like a traditional application
Drawbacks
- scripting required (modern browsers are a must)
- still not as capable as complete server solutions
- requieres new skills (call for a new sort of web developers)
What the future holds
Nobody knows. But web applications are becoming a reality and look like they are here to stay. And not only to stay but to become even more powerful. Maybe in the future the difference between "my local computer" and "the world out there" will drift away.