AJAX (Asynchronous JavaScript And Xml)s
a competitor to Applets. AJAX is not a language or a software
package or even an interface. It’s a word someone invented for the generic concept of having JavaScript
talk directly to the server without reloading the HTML (Hypertext Markup Language) page. There are any number of possible ways of
implementing AJAX. The most common is to use the non-standard XmlHttpRequest class,
which is available from JavaScript in most major browsers.
The major defining characteristic, though, is the asynchronous aspect of the technology. Even XML (extensible Markup Language) is in there
by coincidence; people describe things as “ AJAX ” applications when they don’t use XML at all.
There is no new language or file format here. There’s no specification; no definition of what AJAX is or is
not. There are no special tools. There’s no visual appearance that could be created except what you could
do with a web browser, HTML, JavaScript, and CSS (Cascading Style Sheets) anyway. In fact, if you were allowed to stub out the data, you
could write any AJAX application with only those basic client-side web technologies.
AJAX is typically a generic JavaScript program to allow thin clients to do field validation (by asking the
server) without refreshing the entire page. Google uses it for maps. It works by sending standard HTTP (Hypertext Transfer Protocol) queries to
the server. Your application specific code all lives on the server.
AJAX has the following advantages over Applets:
- JavaScript generally starts faster than an Applet. The browser preloads the
JavaScript run time, but delays loading the Applet JVM (Java Virtual Machine) until first use. The load
overhead for JavaScript gets buried in the browser start up time, when the JVM load gets blamed on the first
Applet. The JVM is a much bigger and more complex animal than the JavaScript
runtime.
- AJAX is really just HTML and JavaScript and CSS, so it acts like a web browser. That is, you can
resize the window and expect to see text and tables wrapped and presented in all the normal ways. All the UI (User Interface)
kludginess of Applets is gone.
- JavaScript is not constrained by the same tight sandbox restrictions as Java. Your users don’t have
to deal with the geekiness of signed Applet permission granting.
- JavaScript comes pre-installed where Java does not.
- Both Applets and AJAX allow user interaction without the delay of a round trip to the server.
AJAX has the following disadvantages:
- Java is object oriented. It won’t fall apart under its own weight as project complexity grows as JavaScript apps will.
- JavaScript has many bugs and platform-specific eccentricities. A properly written AJAX application should have a pure-HTML fallback
in case the JavaScript does not work.
- JavaScript might be looked on as a limited or toy language designed for scripting inside a browser. Java is
a general purpose language suited for pretty well any sort of computation.
- Java security is tighter. Unsigned Applets are less potentially dangeous. Sooner or later after a major
scare, corporate America is going to ban JavaScript from their machines because of security risks. At that
point, all legitimate AJAX code will stop working, so I consider it irresponsible to go the AJAX route.
- JavaScript is not properly supported on mobile devices.
- JavaScript does not work for the visually impaired.
- Firefox has a popular plug-in NoScript which blocks Javascript. Not
everyone uses it but a lot of security conscious
folks do use it.
- There are 2 to 4
browser exploits and security holes a month and about 80%
of the time the advice is “until the manufacturer has a patch
finished, the problem can be avoided by disabling JavaScript”.
Microsoft has embraced AJAX and renamed it Atlas, which
presumably means they are busy figuring out how to lock AJAX apps into Microsoft and make sure Java apps stop
running.
Books
 |
recommend book⇒Pragmatic Ajax, A Web 2.0 Primer |
| by: | Pragmatic Bookshelf |
978-0-9766940-8-3 | paperback |
| publisher: | Pragmatic Bookshelf |
| published: | 2006-04-10 |
| Covers Ajax with Java, .NET, and Ruby on Rails server frameworks. |
|
| Greyed out stores probably do not have the item in stock |