Usage
The most common use of JavaScript is in web pages. These scripts are usually used to provide interaction by responding to events, validating data entered in forms, or creating complex visual effects. JavaScript scripts executed by web pages have limited access to the user's computer. On the server side, JavaScript can run in the form of node.js or Ringo[6].
JavaScript can also be used to write full-fledged applications. The Mozilla Foundation provides an environment consisting of technologies such as XUL, XBL, XPCOM, and JSLib. They allow the creation of applications that use system resources and have a graphical user interface tailored to the platform. An example of an application written using JS and XUL is the ChatZilla IRC client, which is included by default in the Mozilla package. Microsoft provides libraries for creating JScript applications as part of the Windows Scripting Host environment. Additionally, JScript.NET is one of the basic languages of the .NET environment. IBM has also created the SashXB environment for Linux, which allows the creation of GTK+, GNOME, and OpenLDAP applications using JavaScript.
History
In 1996, the ECMA organization began work on a JavaScript specification without references to the environment interpreting the code. The language described in the ECMA-262 standard was named ECMAScript. From that moment on, the name JavaScript only refers to one of the subsets of the ECMAScript language. The first version of the standard was similar to JavaScript version 1.1. The third version was the first to extend existing implementations.
Dialects
Since the creation of JavaScript, various interpretations of it have been developed using separate engines. In addition to implementations introduced into web browsers, there is ActionScript for Adobe Flash applications and UnityScript in the Unity engine (no longer supported since version 2018.2[12]).
Java
Initially, Netscape named the new language LiveScript. However, the name was quickly changed to JavaScript due to business agreements between Netscape and Sun Microsystems (co-owner of the JavaScript trademark is Oracle Corporation, which acquired Sun Microsystems in 2010). JavaScript scripts and Java applets (despite the distinctness of these two languages) can communicate with each other thanks to the available technology LiveConnect in Netscape, Mozilla, and Opera browsers.
JavaScript for WWW
Interaction
All JavaScript implementations available in web browsers provide objects representing the document tree. They can also allow the creation of cookies, manipulation of browser windows, display of simple dialog boxes, retrieval of browser information, management of its plugins, and style sheets. They also respond to events triggered in the interface.
While manipulating the contents of the document, the lack of a standardized model posed a problem. In the fourth generation of browsers, access to certain document elements in Netscape was possible using the document.layers collection, while in Internet Explorer – document.all. However, the W3C organization developed a unified object model supported by all modern browsers (including Opera from version 6, Konqueror from version 3, and Safari). The all and layers arrays were considered obsolete, and support for them was practically withdrawn.
Embedding
In HTML, the <script> element is responsible for placing JS scripts, with optional type arguments with values text/javascript and language with a value of javascript.
If the code is in an XHTML document, to prevent the interpretation of some operators as syntax elements of the language, the script should be enclosed in a CDATA section or written in entity form[14]. In XHTML, the language argument cannot be used to specify the version of the JS language (if used, the attribute should take two-letter values described by the ISO 639 standard, e.g., EN, DE, PL).
External scripts are also added using the above tag, considering only the src parameter with the name of the file containing the script code. The MIME type for standalone JavaScript files is application/javascript or the deprecated text/javascript[15].