Ajax: JavaScript that binds everything together

Oct 13, 2008

JavaScript is the most preferred scripting language for most Web developers. Although Ajax techniques are not the sole preserve of JavaScript, VBScript, a scripting language that also offers the same capabilities for dynamic updates as well, it does so only in an Internet Explorer framework. JavaScript has a standard specified in the EMCAScript standard, but was initially created in Netscape Navigator before such standards existed. Microsoft has created in parallel its own version of JavaScript, called JScript, and as a result, each browser's version of JavaScript incorporation differs from another. Although JavaScript is still a very competent method for updating web pages, some amount of dual-coding is necessary in order to secure that web pages and applications function in the correct way across all browsers. This implies some error-handling code as well.

JavaScript is a dynamic, prototype based language with first class functions and it was influenced by several languages. It was designed to resemble Java, but also be easier for non-programmers to work with. While it is best known for its use in websites, as client-side JavaScript, it is also used to enable scripting access to objects embedded in other applications.

Despite the name, JavaScript is basically unrelated to the Java programming language, although they both have the common C syntax, while JavaScript copies many Java names and naming conventions. Originally named "LiveScript", it was renamed in a co-marketing deal between Netscape and Sun Microsystems, in exchange for Netscape to include Sun's Java runtime in their predominant browser. They key design elements within JavaScript are followers of th Self and Scheme programming languages.

At present, JavaScript is a trademark of Sun Microsystems, being used under license for technology invented and implemented by Netscape Communications and other entities like Mozilla Foundation. But originally, JavaScript was developed by Brendan Eich from Netscape under the code name "Mocha", later renamed LiveScript, and afterwards JavaScript. By the time they changed the name from LiveScript to JavaScript, Netscape added support For Java technology in its Netscape Navigator web browser. In December 1995, JavaScript was first introduced and deployed in the Netscape browser version 2.0B3, causing confusion with the naming by giving the impression that the language was actually a spin-off of Java. Many have characterized it as a business strategy from Netscape to give JavaScript some of the hype of what was then the trendiest new web-programming language.

In order to avoid trademark issues, Microsoft named its dialect of the language JScript, which was first supported in Internet Explorer version 3.0. it was released in August, 1996 and it included Y2K-compliant data functions, not like those based on java.util.Date in JavaScript at the time. Because the dialects are perceived to be so similar, the terms "JavaScript" and "JScript" are often used interchangeably. Netscape submitted JavaScript to ECMA international for standardization, which resulted in the standardized version called ECMAScript.

The primary purpose of JavaScript is to write functions that are embedded in or included from HTML pages and interact with the Document Object Model, or DOM, of the page. JavaScript usage can translate into things like: opening or popping up a new window with programmatic control over the size, position and attributes of the new window, like controlling the visibility of menus or toolbars; validation of web form input values in order to secure their acceptance before they are submitted to the server, and changing images as the mouse cursor scrolls over them, an effect which is used in order to draw attention over important links displayed as graphical elements.

The main advantage of JavaScript is that its code can run locally in a user's browser, rather than on a remote server. Because of this, it can respond to user actions in real time, making an application feel more responsive. Moreover, JavaScript code can detect user actions which HTML could not do by itself, such as individual keystrokes. A good example of this is Gmail, that has taken advantage of this, with a lot of the user-interface logic being written in JavaScript. JavaScript dispatches requests for information, like the content of an e-mail message, to the server, which makes the service mail move really fast and secure. The wider trend of Ajax programming similarly exploits this strength and delivers competent and reliable solutions to web applications.

Read more about it:

Ajax Technology - an Introduction
1. Standards-based presentation using XHTML and CSS
2. Dynamic display and interaction using Document Object Model
3. Data interchange and manipulation using XML and XSLT
4. Asynchronous data retrieval using XMLHttpRequest
5. JavaScript that binds everything together