Vous êtes sur la page 1sur 15

JavaScript

From Wikipedia, the free encyclopedia

JavaScript (JS) is an interpreted computer programming language.[5] As part of web browsers, implementations allow client-side scripts to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed.[5] It has also become common in server-side programming, game development and the creation of desktop applications. JavaScript is a prototype-based scripting language with dynamic typing and has firstclass functions. Its syntax was influenced by C. JavaScript copies many names and naming conventions from Java, but the two languages are otherwise unrelated and have very different semantics. The key design principles within JavaScript are taken from the Self and Scheme programming languages.[6] It is a multi-paradigm language, supporting object-oriented,[7] imperative, and functional[1][8] programming styles. The application of JavaScript to uses outside of web pagesfor example, in PDF documents, site-specific browsers, and desktop widgetsis also significant. Newer and faster JavaScript VMs and frameworks built upon them (notably Node.js) have also increased the popularity of JavaScript for server-side web applications. JavaScript was formalized in the ECMAScript language standard and is primarily used as part of a web browser (client-side JavaScript). This enables programmatic access to computational objects within a host environment.

JavaScript
Paradigm(s) Multi-paradigm: scripting, object-oriented (prototypebased), imperative, functional[1] 1995 Brendan Eich Netscape Communications Corporation, Mozilla Foundation 1.8.5[2] (March 22, 2011)

Appeared in Designed by Developer Stable release

Typing discipline dynamic, duck KJS, Rhino, SpiderMonkey, V8, Major implementations Carakan, Chakra Influenced by Influenced Java, Scheme, Self ActionScript, CoffeeScript, Dart, JScript .NET, Objective-J, QML, TIScript, TypeScript, Node.js JavaScript at Wikibooks

Contents
1 History 1.1 Birth at Netscape 1.2 Server-side JavaScript 1.3 Adoption by Microsoft 1.4 Standardization 1.5 Later developments 2 Trademark 3 Features 3.1 Imperative and structured 3.2 Dynamic 3.3 Functional 3.4 Prototype-based 3.5 Miscellaneous 3.6 Vendor-specific extensions 4 Syntax 4.1 Simple examples 4.2 More advanced example 5 Use in web pages 5.1 Example script 5.2 Compatibility considerations 5.3 Accessibility 6 Security 6.1 Cross-site vulnerabilities 6.1.1 Misplaced trust in the client 6.1.2 Browser and plugin coding errors 6.1.3 Sandbox implementation errors 7 Uses outside web pages 7.1 Embedded scripting language 7.2 Scripting engine 7.3 Application platform 8 Development tools 9 Version history

JavaScript

Filename extension Internet media type Uniform Type Identifier Type of format

. j s

a p p l i c a t i o n / j a v a s c r i p t t e x t / j a v a s c r i p t(obsolete) [3]

com.netscape.javascriptsource[4] Scripting language

10 Related languages and features 10.1 Use as an intermediate language 10.2 JavaScript and Java 11 References 12 Further reading 13 External links

History
Birth at Netscape
JavaScript was originally developed by Brendan Eich. While battling with Microsoft over the Internet, Netscape considered their client-server offering a distributed OS, running a portable version of Sun Microsystems' Java. Because Java was a competitor of C++ and aimed at professional programmers, Netscape also wanted a lightweight interpreted language that would complement Java by appealing to nonprofessional programmers, like Microsoft's Visual Basic (see JavaScript and Java).[9] Although it was developed under the name Mocha, the language was officially called LiveScript when it first shipped in beta releases of Netscape Navigator 2.0 in September 1995, but it was renamed JavaScript[10] when it was deployed in the Netscape browser version 2.0B3.[11] The change of name from LiveScript to JavaScript roughly coincided with Netscape adding support for Java technology in its Netscape Navigator web browser. The final choice of name caused confusion, giving the impression that the language was a spin-off of the Java programming language, and the choice has been characterized by many as a marketing ploy by Netscape to give JavaScript the cachet of what was then the hot new web programming language.[12][13]

Server-side JavaScript
Netscape introduced an implementation of the language for server-side scripting (SSJS) with Netscape Enterprise Server, first released in December, 1994 (soon after releasing JavaScript for browsers).[14][15] Since the mid-2000s, there has been a proliferation of server-side JavaScript implementations. Node.js is one recent notable example of server-side JavaScript being used in real-world applications.[16][17]

Adoption by Microsoft
JavaScript very quickly gained widespread success as a client-side scripting language for web pages. Microsoft introduced JavaScript support in its own web browser, Internet Explorer, in version 3.0, released in August 1996.[18] Microsoft's webserver, Internet Information Server, introduced support for server-side scripting in JavaScript with release 3.0 (1996). Microsoft started to promote webpage scripting using the umbrella term Dynamic HTML. Microsoft's JavaScript implementation was later renamed JScript to avoid trademark issues. JScript added new date methods to fix the Y2Kproblematic methods in JavaScript, which were based on Java's j a v a . u t i l . D a t eclass.

Standardization
In November 1996, Netscape announced that it had submitted JavaScript to Ecma International for consideration as an industry standard, and subsequent work resulted in the standardized version named ECMAScript. In June 1997, Ecma International published the first edition of the ECMA-262 specification. A year later, in June 1998, some modifications were made to adapt it to the ISO/IEC-16262 standard, and the second edition was released. The third edition of ECMA-262 (published on December 1999) is the version most browsers currently use.[19] A fourth edition of the ECMAScript standard was not released and does not exist. Fifth edition of the Ecmascript standard was released in December 2009. The current edition of the ECMAScript standard is 5.1, released in June 2011.[20]

Later developments
JavaScript has become one of the most popular programming languages on the web. Initially, however, many professional programmers denigrated the language because its target audience consisted of web authors and other such "amateurs", among other reasons.[21] The advent of Ajax returned JavaScript to the spotlight and brought more professional programming attention. The result was a proliferation of comprehensive frameworks and libraries, improved JavaScript programming practices, and increased usage of JavaScript outside of web browsers, as seen by the proliferation of server-side JavaScript platforms.

In January 2009, the CommonJS project was founded with the goal of specifying a common standard library mainly for JavaScript development outside the browser.[22]

Trademark
Today, "JavaScript" is a trademark of Oracle Corporation.[23] It is used under license for technology invented and implemented by Netscape Communications and current entities such as the Mozilla Foundation.[24]

Features
The following features are common to all conforming ECMAScript implementations, unless explicitly specified otherwise.

Imperative and structured


JavaScript supports much of the structured programming syntax from C (e.g., i fstatements, w h i l eloops, s w i t c hstatements, etc.). One partial exception is scoping: C-style block scoping is not supported. Instead, JavaScript has function scoping (although, block scoping using the l e tkeyword was added in JavaScript 1.7). Like C, JavaScript makes a distinction between expressions and statements. One syntactic difference from C is automatic semicolon insertion, in which the semicolons that terminate statements can be omitted.[25]

Dynamic
Dynamic typing As in most scripting languages, types are associated with values, not with variables. For example, a variable xcould be bound to a number, then later rebound to a string. JavaScript supports various ways to test the type of an object, including duck typing.[26] Object based JavaScript is almost entirely object-based. JavaScript objects are associative arrays, augmented with prototypes (see below). Object property names are string keys. They support two equivalent syntaxes: dot notation (o b j . x=1 0 ) and bracket notation (o b j [ ' x ' ]=1 0 ). Properties and their values can be added, changed, or deleted at run-time. Most properties of an object (and those on its prototype inheritance chain) can be enumerated using a f o r . . . i nloop. JavaScript has a small number of built-in objects such as F u n c t i o nand D a t e . Run-time evaluation JavaScript includes an e v a lfunction that can execute statements provided as strings at run-time.

Functional

First-class functions Functions are first-class; they are objects themselves. As such, they have properties and methods, such as . c a l l ( )and . b i n d ( ) .[27] A nested function is a function defined within another function. It is created each time the outer function is invoked. In addition, each created function forms a lexical closure: the lexical scope of the outer function, including any constants, local variables and argument values, becomes part of the internal state of each inner function object, even after execution of the outer function concludes.[28]

Prototype-based
Prototypes JavaScript uses prototypes where many other object oriented languages use classes for inheritance.[29] It is possible to simulate many class-based features with prototypes in JavaScript.[30] Functions as object constructors Functions double as object constructors along with their typical role. Prefixing a function call with n e wwill create an instance of a prototype, inheriting properties and methods from the constructor (including properties from the O b j e c tprototype).[31] ECMAScript 5 offers the O b j e c t . c r e a t emethod, allowing explicit creation of an instance without automatically inheriting from the O b j e c tprototype [32] (older environments can assign the prototype to n u l l ). The constructor's p r o t o t y p eproperty determines the object used for the new object's internal prototype. New methods can be added by modifying the prototype of the object used as a constructor. JavaScript's built-in constructors, such as A r r a yor O b j e c t , also have prototypes that can be modified. While it is possible to modify the O b j e c tprototype, it is generally considered bad practice because most objects in Javascript will inherit methods and properties from the O b j e c tprototype and they may not expect the prototype to be modified.[33] Functions as methods Unlike many object-oriented languages, there is no distinction between a function definition and a method definition. Rather, the distinction occurs during function calling; when a function is called as a method of an object, the function's local t h i skeyword is bound to that object for that invocation.

Miscellaneous
Run-time environment JavaScript typically relies on a run-time environment (e.g. a web browser) to provide objects and methods by which scripts can interact with the environment (e.g. a webpage DOM). It also relies on the run-time environment to provide the ability to include/import scripts (e.g. HTML < s c r i p t >elements). This is not a language feature per se, but it is common in most JavaScript implementations. Variadic functions An indefinite number of parameters can be passed to a function. The function can access them through formal parameters and also through the local a r g u m e n t sobject. Variadic functions can also be created by using the a p p l ymethod. Array and object literals Like many scripting languages, arrays and objects (associative arrays in other languages) can each be created with a succinct shortcut syntax. In fact, these literals form the basis of the JSON data format. Regular expressions JavaScript also supports regular expressions in a manner similar to Perl, which provide a concise and powerful syntax for text manipulation that is more sophisticated than the built-in string functions.[34]

Vendor-specific extensions
JavaScript is officially managed by Mozilla Foundation, and new language features are added periodically. However, only some JavaScript engines support these new features: property getter and setter functions (supported by WebKit, Opera,[35] ActionScript, and Rhino)[36] conditional c a t c hclauses iterator protocol (adopted from Python) shallow generators-coroutines (adopted from Python) array comprehensions and generator expressions (adopted from Python) proper block scope via the l e tkeyword array and object destructuring (limited form of pattern matching) concise function expressions (f u n c t i o n ( a r g s )e x p r ) ECMAScript for XML (E4X), an extension that adds native XML support to ECMAScript

Syntax
Main article: JavaScript syntax As of 2011, the latest version of the language is JavaScript 1.8.5. It is a superset of ECMAScript (ECMA-262) Edition 3. Extensions to the language, including partial ECMAScript for XML (E4X) (ECMA-357) support and experimental features considered for inclusion into future ECMAScript editions, are documented here.[37]

Simple examples
Variables in JavaScript can be defined using the v a rkeyword:[38]
v a rx ;/ / d e f i n e st h ev a r i a b l ex ,a l t h o u g hn ov a l u ei sa s s i g n e dt oi tb yd e f a u l t v a ry=2 ;/ / d e f i n e st h ev a r i a b l eya n da s s i g n st h ev a l u eo f2t oi t

Note the comments in the example above, both of which were preceded with two forward slashes. There is no built-in I/O functionality in JavaScript; the runtime environment provides that. The ECMAScript specification in edition 5.1 mentions:[39] ... indeed, there are no provisions in this specification for input of external data or output of computed results. However, most runtime environments have a c o n s o l eobject[40] that can be used to print output. Here is a minimalist Hello World program:
c o n s o l e . l o g ( " H e l l ow o r l d ! " ) ;

A simple recursive function:


f u n c t i o nf a c t o r i a l ( n ){ i f( n= = =0 ){

r e t u r n1 ; } r e t u r nn*f a c t o r i a l ( n-1 ) ;

Anonymous function (or lambda) syntax and closure example:


v a rd i s p l a y C l o s u r e=f u n c t i o n ( ){ v a rc o u n t=0 ; r e t u r nf u n c t i o n( ){ r e t u r n+ + c o u n t ; } ; } v a ri n c=d i s p l a y C l o s u r e ( ) ; i n c ( ) ;/ /r e t u r n s1 i n c ( ) ;/ /r e t u r n s2 i n c ( ) ;/ /r e t u r n s3

Variadic function demonstration (a r g u m e n t sis a special variable).[41]


v a rs u m=f u n c t i o n ( ){ v a ri ,x=0 ; f o r( i=0 ;i<a r g u m e n t s . l e n g t h ;+ + i ){ x+ =a r g u m e n t s [ i ] ; } r e t u r nx ; } s u m ( 1 ,2 ,3 ) ;/ /r e t u r n s6

Immediately-invoked function expressions allow functions to pass around variables under their own closures.
v a rv ; v=1 ; v a rg e t V a l u e=( f u n c t i o n ( v ){ r e t u r nf u n c t i o n ( ){ r e t u r nv ; } ; } ) ( v ) ; v=2 ; g e t V a l u e ( ) ;/ /1

More advanced example


This sample code displays various JavaScript features.
/ *F i n d st h el o w e s tc o m m o nm u l t i p l e( L C M )o ft w on u m b e r s* / f u n c t i o nL C M C a l c u l a t o r ( x ,y ){/ /c o n s t r u c t o rf u n c t i o n v a rc h e c k I n t=f u n c t i o n( x ){/ /i n n e rf u n c t i o n i f( x%1! = =0 ){ t h r o wn e wT y p e E r r o r ( x+"i sn o ta ni n t e g e r " ) ;/ /t h r o wa ne x c e p t i o n } r e t u r nx ; } ; t h i s . a=c h e c k I n t ( x ) / / s e m i c o l o n s ^ ^ ^ ^ a r eo p t i o n a l ,an e w l i n ei se n o u g h t h i s . b=c h e c k I n t ( y ) ; } / /T h ep r o t o t y p eo fo b j e c ti n s t a n c e sc r e a t e db yac o n s t r u c t o ri s / /t h a tc o n s t r u c t o r ' s" p r o t o t y p e "p r o p e r t y . L C M C a l c u l a t o r . p r o t o t y p e={/ /o b j e c tl i t e r a l c o n s t r u c t o r :L C M C a l c u l a t o r ,/ /w h e nr e a s s i g n i n gap r o t o t y p e ,s e tt h ec o n s t r u c t o rp r o p e r t ya p p r o p r i a t e l y g c d :f u n c t i o n( ){/ /m e t h o dt h a tc a l c u l a t e st h eg r e a t e s tc o m m o nd i v i s o r / /E u c l i d e a na l g o r i t h m : v a ra=M a t h . a b s ( t h i s . a ) ,b=M a t h . a b s ( t h i s . b ) ,t ; i f( a<b ){ / /s w a pv a r i a b l e s t=b ; b=a ; a=t ; } w h i l e( b! = =0 ){ t=b ; b=a%b ; a=t ; } / /O n l yn e e dt oc a l c u l a t eG C Do n c e ,s o" r e d e f i n e "t h i sm e t h o d . / /( A c t u a l l yn o tr e d e f i n i t i o n i t ' sd e f i n e do nt h ei n s t a n c ei t s e l f , / /s ot h a tt h i s . g c dr e f e r st ot h i s" r e d e f i n i t i o n "i n s t e a do fL C M C a l c u l a t o r . p r o t o t y p e . g c d . ) / /A l s o ,' g c d '= = =" g c d " ,t h i s [ ' g c d ' ]= = =t h i s . g c d t h i s [ ' g c d ' ]=f u n c t i o n( ){ r e t u r na ; } ; r e t u r na ; } ,

} ;

/ /O b j e c tp r o p e r t yn a m e sc a nb es p e c i f i e db ys t r i n g sd e l i m i t e db yd o u b l e( " )o rs i n g l e( ' )q u o t e s . " l c m ":f u n c t i o n( ){ / /V a r i a b l en a m e sd o n ' tc o l l i d ew i t ho b j e c tp r o p e r t i e s ,e . g .| l c m |i sn o t| t h i s . l c m | . / /n o tu s i n g| t h i s . a*t h i s . b |t oa v o i dF Pp r e c i s i o ni s s u e s v a rl c m=t h i s . a/t h i s . g c d ( )*t h i s . b ; / /O n l yn e e dt oc a l c u l a t el c mo n c e ,s o" r e d e f i n e "t h i sm e t h o d . t h i s . l c m=f u n c t i o n( ){ r e t u r nl c m ; } ; r e t u r nl c m ; } , t o S t r i n g :f u n c t i o n( ){ r e t u r n" L C M C a l c u l a t o r :a="+t h i s . a+" ,b="+t h i s . b ; }

/ /D e f i n eg e n e r i co u t p u tf u n c t i o n ;t h i si m p l e m e n t a t i o no n l yw o r k sf o rw e bb r o w s e r s f u n c t i o no u t p u t ( x ){ d o c u m e n t . b o d y . a p p e n d C h i l d ( d o c u m e n t . c r e a t e T e x t N o d e ( x ) ) ; d o c u m e n t . b o d y . a p p e n d C h i l d ( d o c u m e n t . c r e a t e E l e m e n t ( ' b r ' ) ) ; } / /N o t e :A r r a y ' sm a p ( )a n df o r E a c h ( )a r ed e f i n e di nJ a v a S c r i p t1 . 6 . / /T h e ya r eu s e dh e r et od e m o n s t r a t eJ a v a S c r i p t ' si n h e r e n tf u n c t i o n a ln a t u r e . [ [ 2 5 ,5 5 ] ,[ 2 1 ,5 6 ] ,[ 2 2 ,5 8 ] ,[ 2 8 ,5 6 ] ] . m a p ( f u n c t i o n( p a i r ){/ /a r r a yl i t e r a l+m a p p i n gf u n c t i o n r e t u r nn e wL C M C a l c u l a t o r ( p a i r [ 0 ] ,p a i r [ 1 ] ) ; } ) . s o r t ( f u n c t i o n( a ,b ){/ /s o r tw i t ht h i sc o m p a r a t i v ef u n c t i o n r e t u r na . l c m ( )-b . l c m ( ) ; } ) . f o r E a c h ( f u n c t i o n( o b j ){ o u t p u t ( o b j+" ,g c d="+o b j . g c d ( )+" ,l c m="+o b j . l c m ( ) ) ; } ) ;

The following output should be displayed in the browser window.


L C M C a l c u l a t o r :a=2 8 ,b=5 6 ,g c d=2 8 ,l c m=5 6 L C M C a l c u l a t o r :a=2 1 ,b=5 6 ,g c d=7 ,l c m=1 6 8 L C M C a l c u l a t o r :a=2 5 ,b=5 5 ,g c d=5 ,l c m=2 7 5 L C M C a l c u l a t o r :a=2 2 ,b=5 8 ,g c d=2 ,l c m=6 3 8

Use in web pages


See also: JavaScript engine and Ajax (programming) The most common use of JavaScript is to write functions that are embedded in or included from HTML pages and that interact with the Document Object Model (DOM) of the page. Some simple examples of this usage are: Loading new page content or submitting data to the server via AJAX without reloading the page (for example, a social network might allow the user to post status updates without leaving the page) Animation of page elements, fading them in and out, resizing them, moving them, etc. Interactive content, for example games, and playing audio and video Validating input values of a web form to make sure that they are acceptable before being submitted to the server. Transmitting information about the user's reading habits and browsing activities to various websites. Web pages frequently do this for web analytics, ad tracking, personalization or other purposes.[42] Because JavaScript code can run locally in a user's browser (rather than on a remote server), the browser can respond to user actions quickly, making an application more responsive. Furthermore, JavaScript code can detect user actions which HTML alone cannot, such as individual keystrokes. Applications such as Gmail take advantage of this: much of the user-interface logic is written in JavaScript, and JavaScript dispatches requests for information (such as the content of an e-mail message) to the server. The wider trend of Ajax programming similarly exploits this strength. A JavaScript engine (also known as JavaScript interpreter or JavaScript implementation) is an interpreter that interprets JavaScript source code and executes the script accordingly. The first JavaScript engine was created by Brendan Eich at Netscape Communications Corporation, for the Netscape Navigator web browser. The engine, code-named SpiderMonkey, is implemented in C. It has since been updated (in JavaScript 1.5) to conform to ECMA-262 Edition 3. The Rhino engine, created primarily by Norris Boyd (formerly of Netscape; now at Google) is a JavaScript implementation in Java. Rhino, like SpiderMonkey, is ECMA-262 Edition 3 compliant. A web browser is by far the most common host environment for JavaScript. Web browsers typically create "host objects" to represent the Document Object Model (DOM) in JavaScript. The web server is another common host environment. A JavaScript webserver would typically expose host objects representing HTTP request and response objects, which a JavaScript program could then interrogate and manipulate to dynamically generate web pages. Because JavaScript is the only language that the most popular browsers share support for, it has become a target language for many frameworks in other languages, even though JavaScript was never intended to be such a language.[43] Despite the performance limitations inherent to its dynamic nature, the increasing speed of JavaScript engines has made the language a surprisingly feasible compilation target.

Example script
Below is a minimal example of a standards-conforming web page containing JavaScript (using HTML 5 syntax) and the DOM:
< ! D O C T Y P Eh t m l > < m e t ac h a r s e t = " u t f 8 " > < t i t l e > M i n i m a lE x a m p l e < / t i t l e > < h 1i d = " h e a d e r " > T h i si sJ a v a S c r i p t < / h 1 > < s c r i p t > d o c u m e n t . b o d y . a p p e n d C h i l d ( d o c u m e n t . c r e a t e T e x t N o d e ( ' H e l l oW o r l d ! ' ) ) ; v a rh 1=d o c u m e n t . g e t E l e m e n t B y I d ( ' h e a d e r ' ) ;/ /h o l d sar e f e r e n c et ot h e< h 1 >t a g h 1=d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( ' h 1 ' ) [ 0 ] ;/ /a c c e s s i n gt h es a m e< h 1 >e l e m e n t < / s c r i p t > < n o s c r i p t > Y o u rb r o w s e re i t h e rd o e sn o ts u p p o r tJ a v a S c r i p t ,o rh a si tt u r n e do f f . < / n o s c r i p t >

Compatibility considerations
Main article: Web interoperability Because JavaScript runs in widely varying environments, an important part of testing and debugging is to test and verify that the JavaScript works across multiple browsers.

The DOM interfaces for manipulating web pages are not part of the ECMAScript standard, or of JavaScript itself. Officially, the DOM interfaces are defined by a separate standardization effort by the W3C; in practice, browser implementations differ from the standards and from each other, and not all browsers execute JavaScript.

To deal with these differences, JavaScript authors can attempt to write standards-compliant code which will also be executed correctly by most browsers; failing that, they can write code that checks for the presence of certain browser features and behaves differently if they are not available.[44] In some cases, two browsers may both implement a feature but with different behavior, and authors may find it practical to detect what browser is running and change their script's behavior to match.[45][46] Programmers may also use libraries or toolkits which take browser differences into account. Furthermore, scripts may not work for some users. For example, a user may: use an old or rare browser with incomplete or unusual DOM support, use a PDA or mobile phone browser which cannot execute JavaScript, have JavaScript execution disabled as a security precaution, use a speech browser due to, for example, a visual disability. To support these users, web authors can try to create pages which degrade gracefully on user agents (browsers) which do not support the page's JavaScript. In particular, the page should remain usable albeit without the extra features that the JavaScript would have added. An alternative approach that many find preferable is to first author content using basic technologies that work in all browsers, then enhance the content for users that have JavaScript enabled. This is known as progressive enhancement.

Accessibility
Main article: Web accessibility Assuming that the user has not disabled its execution, client-side web JavaScript should be written to enhance the experiences of visitors with visual or physical disabilities, and certainly should avoid denying information to these visitors.[47] Screen readers, used by the blind and partially sighted, can be JavaScript-aware and so may access and read the page DOM after the script has altered it. The HTML should be as concise, navigable and semantically rich as possible whether the scripts have run or not. JavaScript should not be totally reliant on mouse or keyboard specific events because a user may be physically unable to use these input devices. For this reason, device-agnostic events such as o n f o c u sand o n c h a n g eare preferable to device-centric events such as o n m o u s e o v e rand [47] o n k e y p r e s sin most cases. JavaScript should not be used in a way that is confusing or disorienting to any web user. For example, using script to alter or disable the normal functionality of the browser, such as by changing the way the "back" or "refresh" buttons work, is usually best avoided. Equally, triggering events that the user may not be aware of reduces the user's sense of control as do unexpected scripted changes to the page content.[48]

Often the process of making a complex web page as accessible as possible becomes a nontrivial problem where issues become matters of debate and opinion, and where compromises are necessary in the end. However, user agents and assistive technologies are constantly evolving and new guidelines and relevant information are continually being published on the web.[47]

Security
See also: Browser security JavaScript and the DOM provide the potential for malicious authors to deliver scripts to run on a client computer via the web. Browser authors contain this risk using two restrictions. First, scripts run in a sandbox in which they can only perform web-related actions, not general-purpose programming tasks like creating files. Second, scripts are constrained by the same origin policy: scripts from one web site do not have access to information such as usernames, passwords, or cookies sent to another site. Most JavaScript-related security bugs are breaches of either the same origin policy or the sandbox. There are subsets of general JavaScript ADsafe, Secure ECMA Script (SES) that provide greater level of security, especially on code created by third parties (such as advertisements).[49][50] Content Security Policy is the main intended method of ensuring that only trusted code is executed on a web page. See also: Content Security Policy

Cross-site vulnerabilities
Main articles: Cross-site scripting and Cross-site request forgery

A common JavaScript-related security problem is cross-site scripting, or XSS, a violation of the same-origin policy. XSS vulnerabilities occur when an attacker is able to cause a target web site, such as an online banking website, to include a malicious script in the webpage presented to a victim. The script in this example can then access the banking application with the privileges of the victim, potentially disclosing secret information or transferring money without the victim's authorization. A solution to XSS vulnerabilities is to use HTML escaping whenever displaying untrusted data. Some browsers include partial protection against reflected XSS attacks, in which the attacker provides a URL including malicious script. However, even users of those browsers are vulnerable to other XSS attacks, such as those where the malicious code is stored in a database. Only correct design of Web applications on the server side can fully prevent XSS. XSS vulnerabilities can also occur because of implementation mistakes by browser authors.[51] Another cross-site vulnerability is cross-site request forgery or CSRF. In CSRF, code on an attacker's site tricks the victim's browser into taking actions the user didn't intend at a target site (like transferring money at a bank). It works because, if the target site relies only on cookies to authenticate requests, then requests initiated by code on the attacker's site will carry the same legitimate login credentials as requests initiated by the user. In general, the solution to CSRF is to require an authentication value in a hidden form field, and not only in the cookies, to authenticate any request that might have lasting effects. Checking the HTTP Referrer header can also help. "JavaScript hijacking" is a type of CSRF attack in which a <script> tag on an attacker's site exploits a page on the victim's site that returns private information such as JSON or JavaScript. Possible solutions include: requiring an authentication token in the POST and GET parameters for any response that returns private information using POST and never GET for requests that return private information Misplaced trust in the client Developers of client-server applications must recognize that untrusted clients may be under the control of attackers. The application author cannot assume that his JavaScript code will run as intended (or at all) because any secret embedded in the code could be extracted by a determined adversary. Some implications are: Web site authors cannot perfectly conceal how their JavaScript operates because the raw source code must be sent to the client. The code can be obfuscated, but obfuscation can be reverse-engineered. JavaScript form validation only provides convenience for users, not security. If a site verifies that the user agreed to its terms of service, or filters invalid characters out of fields that should only contain numbers, it must do so on the server, not only the client. Scripts can be selectively disabled, so JavaScript can't be relied on to prevent operations such as right-clicking on an image to save it.[52] It is extremely bad practice to embed sensitive information such as passwords in JavaScript because it can be extracted by an attacker.

Browser and plugin coding errors JavaScript provides an interface to a wide range of browser capabilities, some of which may have flaws such as buffer overflows. These flaws can allow attackers to write scripts which would run any code they wish on the user's system. This code is not by any means limited to another JavaScript application. For example, a buffer overrun exploit can allow an attacker to gain access to the operating system's API with superuser privileges. These flaws have affected major browsers including Firefox,[53] Internet Explorer,[54] and Safari.[55] Plugins, such as video players, Adobe Flash, and the wide range of ActiveX controls enabled by default in Microsoft Internet Explorer, may also have flaws exploitable via JavaScript (such flaws have been exploited in the past).[56][57] In Windows Vista, Microsoft has attempted to contain the risks of bugs such as buffer overflows by running the Internet Explorer process with limited privileges.[58] Google Chrome similarly confines its page renderers to their own "sandbox". Sandbox implementation errors Web browsers are capable of running JavaScript outside of the sandbox, with the privileges necessary to, for example, create or delete files. Of course, such privileges aren't meant to be granted to code from the web. Incorrectly granting privileges to JavaScript from the web has played a role in vulnerabilities in both Internet Explorer[59] and Firefox.[60] In Windows XP Service Pack 2, Microsoft demoted JScript's privileges in Internet Explorer.[61] Microsoft Windows allows JavaScript source files on a computer's hard drive to be launched as general-purpose, non-sandboxed programs (see: Windows Script Host). This makes JavaScript (like VBScript) a theoretically viable vector for a Trojan horse, although JavaScript Trojan horses are uncommon in practice.[62]

Uses outside web pages


In addition to web browsers and servers, JavaScript interpreters are embedded in a number of tools. Each of these applications provides its own object model which provides access to the host environment. The core JavaScript language remains mostly the same in each application.

Embedded scripting language


Google's Chrome extensions, Opera's extensions, Apple's Safari 5 extensions, Apple's Dashboard Widgets, Microsoft's Gadgets, Yahoo! Widgets, Google Desktop Gadgets, and Serence Klipfolio are implemented using JavaScript. Adobe's Acrobat and Adobe Reader support JavaScript in PDF files.[63] Tools in the Adobe Creative Suite, including Photoshop, Illustrator, Dreamweaver, and InDesign, allow scripting through JavaScript. OpenOffice.org, an office application suite, allows JavaScript to be used as a scripting language. The interactive music signal processing software Max/MSP released by Cycling '74, offers a JavaScript model of its environment for use by developers. It allows much more precise control than the default GUI-centric programming model. ECMAScript was included in the VRML97 standard for scripting nodes of VRML scene description files. Sphere is an open-source and cross-platform computer program designed primarily to make role-playing games that use JavaScript as a scripting language. The open-source Re-Animator framework allows developing 2D sprite-based games using JavaScript and XML.[64] The Unity game engine supports a modified version of JavaScript for scripting via Mono.[65] DX Studio (3D engine) uses the SpiderMonkey implementation of JavaScript for game and simulation logic.[66] Maxwell Render (rendering software) provides an ECMA standard based scripting engine for tasks automation.[67] Google Apps Script in Google Spreadsheets and Google Sites allows users to create custom formulas, automate repetitive tasks and also interact with other Google products such as Gmail.[68] Many IRC clients, like ChatZilla or XChat, use JavaScript for their scripting abilities.[69][70] SpinetiX products use the SpiderMonkey JavaScript engine to allow scripting within SVG files to create digital signage projects.[71] Cloud Party virtual world uses a limited version of JavaScript/ECMAScript 5 as in-world scripting language.[72]

Scripting engine
Microsoft's Active Scripting technology supports JScript as a scripting language.[73] The Java programming language introduced the j a v a x . s c r i p tpackage in version 6 that includes a JavaScript implementation based on Mozilla Rhino. Thus, Java applications can host scripts that access the application's variables and objects, much like web browsers host scripts that access a webpage's Document Object Model (DOM).[74][75]

The Qt C++ toolkit includes a Q t S c r i p tmodule to interpret JavaScript, analogous to Java's j a v a x . s c r i p tpackage.[76] JSDB (JavaScript for Databases) is an open-source JavaScript shell for Windows, Mac OS X, Linux, and Unix, which extends the Mozilla JavaScript engine with file, database, email, and network objects.[77] jslibs is an open-source JavaScript shell for Windows and Linux which extends the Mozilla JavaScript engine. It has the ability to call functions in commonly used libraries like NSPR, SQLite, libTomCrypt, OpenGL, OpenAL, and librsvg.[78] Late Night Software's JavaScript OSA (aka JavaScript for OSA, or JSOSA) is a freeware alternative to AppleScript for Mac OS X. It is based on the Mozilla 1.5 JavaScript implementation, with the addition of a M a c O Sobject for interaction with the operating system and [79] third-party applications.

Application platform
ActionScript, the programming language used in Adobe Flash, is another implementation of the ECMAScript standard. Adobe Integrated Runtime is a JavaScript runtime that allows developers to create desktop applications. CA, Inc.'s AutoShell cross-application scripting environment is built on the SpiderMonkey Javascript engine. It contains preprocessorlike extensions for command definition, as well as custom classes for various system-related tasks like file I/O, operation system command invocation and redirection, and COM scripting. GNOME Shell, the shell for the GNOME 3 desktop environment,[80] made Javascript its default programming language in 2013.[81] The Mozilla platform, which underlies Firefox, Thunderbird, and some other web browsers, uses JavaScript to implement the graphical user interface (GUI) of its various products. myNFC is a JavaScript based framework that allows developers to create applications for smart phones.[82] Qt Quick's markup language (available since Qt 4.7) uses JavaScript for its application logic. Its declarative syntax is also similar to JavaScript. TypeScript is a programming language based on JavaScript that adds support for optional type annotations and some other language extensions such as classes, interfaces and modules. A TS-script compiles into plain JavaScript and can be executed in any JS host supporting ECMAScript 3 or higher. The compiler is itself written in TypeScript. Ubuntu Touch provides a JavaScript API for its unified usability interface. webOS uses the WebKit implementation of JavaScript in its SDK to allow developers to create stand-alone applications solely in JavaScript. WinJS provides a special Windows Library for JavaScript functionality in Windows 8 that enables the development of Modern style (formerly Metro style) applications in HTML5 and JavaScript.

Development tools
Within JavaScript, access to a debugger becomes invaluable when developing large, non-trivial programs. Because there can be implementation differences between the various browsers (particularly within the Document Object Model), it is useful to have access to a debugger for each of the browsers that a web application targets.[83] Script debuggers are available for Internet Explorer, Firefox, Safari, Google Chrome, and Opera.[84][85] Three debuggers are available for Internet Explorer: Microsoft Visual Studio is the richest of the three, closely followed by Microsoft Script Editor (a component of Microsoft Office),[86] and finally the free Microsoft Script Debugger which is far more basic than the other two. The free Microsoft Visual Web Developer Express provides a limited version of the JavaScript debugging functionality in Microsoft Visual Studio. Internet Explorer has included developer tools since version 8 (reached by pressing the F12 key).

Web applications within Firefox can be debugged using the Firebug add-on, or the older Venkman debugger. Firefox also has a simpler built-in Error Console, which logs and evaluates JavaScript. It also logs CSS errors and warnings. Opera includes a set of tools called Dragonfly.[87] WebKit's Web Inspector includes a JavaScript debugger,[88] which is used in Safari. A modified version is used in Google Chrome. Some debugging aids are themselves written in JavaScript and built to run on the Web. An example is the program JSLint, developed by Douglas Crockford who has written extensively on the language. JSLint scans JavaScript code for conformance to a set of standards and guidelines.

Version history
See also: ECMAScript#Dialects and ECMAScript#Version correspondence The following table is based on information from multiple sources.[89][90][91]

Version 1.0 1.1 1.2 1.3 1.4

Release date March 1996 August 1996 June 1997 October 1998

Equivalent to

Netscape Mozilla Internet Opera Safari Navigator Firefox Explorer 2.0 3.0 4.0-4.05 3[92] 4.0 5[93] 6 5.5 (JScript 5.5), 6 (JScript 5.6), 7 (JScript 5.7), 8 (JScript 5.8) 3.0

Google Chrome

ECMA-262 1st + 2nd edition

4.06-4.7x Netscape Server

1.5

November 2000

ECMA-262 3rd edition

6.0

1.0

7.0

3.0-5 1.0-10.0.666

1.6

November 2005

1.5 + array extras + array and string generics + E4X

1.5

1.7

1.6 + Pythonic generators (https://developer.mozilla.org/enOctober US/docs/JavaScript/New_in_JavaScript/1.7? 2006 redirectlocale=enUS&redirectslug=New_in_JavaScript_1.7#Generators) + iterators + let June 2008 June 22, 2009 July 27, 2010 1.7 + generator expressions + expression closures 1.8 + native JSON support + minor updates 1.8.1 + minor updates 1.8.2 + ECMAScript 5 compliance

2.0

28.0.1500.95

1.8 1.8.1 1.8.2 1.8.5 1.8.6


Legend:

3.0 3.5 3.6 4 17 9

11.50

11.60

Old version

Latest version

Related languages and features


JSON, or JavaScript Object Notation, is a general-purpose data interchange format that is defined as a subset of JavaScript's literal syntax. jQuery and Prototype are popular JavaScript libraries designed to simplify DOM-oriented client-side HTML scripting. Mozilla browsers currently support LiveConnect, a feature that allows JavaScript and Java to intercommunicate on the web. However, Mozilla-specific support for LiveConnect is scheduled to be phased out in the future in favor of passing on the LiveConnect handling via NPAPI to the Java 1.6+ plug-in (not yet supported on the Mac as of March 2010).[94] Most browser inspection tools, such as Firebug in Firefox, include JavaScript interpreters that can act on the visible page's DOM.

Use as an intermediate language


As JavaScript is the most widely supported client-side language that can run within a web browser, it has become an intermediate language for other languages to target. This has included both newly-created languages and ports of existing languages. Some of these include:

Objective-J, a superset of JavaScript that compiles to standard JavaScript. It adds traditional inheritance and Smalltalk/Objective-C style dynamic dispatch and optional pseudo-static typing to JavaScript. Processing.js, a JavaScript port of Processing, a programming language designed to write visualizations, images, and interactive content. It allows web browsers to display animations, visual applications, games and other graphical rich content without the need for a Java applet or Flash plugin. CoffeeScript, an alternate syntax for JavaScript intended to be more concise and readable. It adds features like array comprehensions (also available in JavaScript since version 1.7[95]) and pattern matching. Like Objective-J, it compiles to JavaScript. Ruby and Python have been cited as influential on CoffeeScript syntax. Google Web Toolkit translates a subset of Java to JavaScript. Scala, an object-oriented and functional programming language, has an experimental Scala-to-Javascript compiler (http://lampwww.epfl.ch/~doeraene/scala-js/). Quby (http://www.playmycode.com/build/sandbox), a proprietary sand-boxed Ruby-like language by PlayMyCode used for building browser games. OMeta (http://tinlizzie.org/ometa/), a functional language featuring pattern matching. Phype (https://code.google.com/p/phype/), an open-source PHP-to-JavaScript compiler. TIScript (https://code.google.com/p/tiscript/), a superset of JavaScript that adds classes, namespaces, and lambda expressions. ClojureScript (https://github.com/clojure/clojurescript), a Clojure to JavaScript compiler which is compatible with the advanced compilation mode of the Google Closure optimizing compiler. Parenscript (http://common-lisp.net/project/parenscript), a Common Lisp library that can translate both well-circumscribed Common Lisp code, and JavaScript rendered as "inlined" S-expressions to Javascript. Py2JS (https://github.com/qsnake/py2js), a subset of Python Pyjamas, a port of Google Web Toolkit to Python (translates a subset of Python to JavaScript) Dart, an open-source programming language developed by Google, can be compiled to JavaScript. Whalesong (http://hashcollision.org/whalesong/), a Racket-to-JavaScript compiler. Emscripten, a LLVM-backend for porting native libraries to JavaScript. Fantom a programming language that runs on JVM, .NET and JavaScript. TypeScript, a free and open-source programming language developed by Microsoft. It is a superset of JavaScript, and essentially adds optional static typing and class-based object-oriented programming to the language. Haxe, an open-source high-level multiplatform programming language and compiler that can produce applications and source code for many different platforms including JavaScript.

JavaScript and Java


A common misconception is that JavaScript is similar or closely related to Java. It is true that both have a C-like syntax (the C language being their most immediate common ancestor language). They also are both typically sandboxed (when used inside a browser), and JavaScript was designed with Java's syntax and standard library in mind. In particular, all Java keywords were reserved in original JavaScript, JavaScript's standard library follows Java's naming conventions, and JavaScript's Math and Date objects are based on classes from Java 1.0,[18] but the similarities end there. The differences between the two languages are more prominent than their similarities. Java has static typing, while JavaScript's typing is dynamic (meaning a variable can hold an object of any type and cannot be restricted). Java is loaded from compiled bytecode, while JavaScript is loaded as human-readable source code. Java's objects are class-based, while JavaScript's are prototype-based. Finally, Java does not support functional programming, while Javascript does, as it contains many features based on the Scheme language.

References
1. ^ a b Douglas Crockford. Douglas Crockford on Functional JavaScript (http://www.blinkx.com/video/douglas-crockford-on-functionaljavascript/xscZz8XhfuNQ_aaVuyUB2A) (flv) (Tech talk). blinkx. Event occurs at 2:49. "[JavaScript] is also coincidentally the world's most popular functional programming language. JavaScript is and has always been, at least since [version] 1.2, a functional programming language." 2. ^ "New in JavaScript 1.8.5 | Mozilla Developer Network" (https://developer.mozilla.org/en/JavaScript/New_in_JavaScript/1.8.5). Developer.mozilla.org. 2012-11-18. Retrieved 2013-05-26. 3. ^ "RFC 4329" (http://www.apps.ietf.org/rfc/rfc4329.html#sec-7.1). Apps.ietf.org. Retrieved 2013-05-26. 4. ^ "System-Declared Uniform Type Identifiers" (http://developer.apple.com/mac/library/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html). Mac OS X Reference Library. Apple Inc. Retrieved 2010-03-05. 5. ^ a b Flanagan & Ferguson 2006, p. 1. 6. ^ "ECMAScript Language Overview" (http://www.ecmascript.org/es4/spec/overview.pdf) (PDF). 2007-10-23. p. 4. Retrieved 2009-05-03. 7. ^ "ECMAScript Language Specification" (http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf). 8. ^ The Little JavaScripter (http://www.crockford.com/javascript/little.html) shows the relationship with Scheme in more detail. 9. ^ Severance, Charles (February 2012). "Java Script: Designing a Language in 10 Days" (http://www.computer.org/csdl/mags/co/2012/02/mco2012020007-abs.html). Computer (IEEE Computer Society) 45 (2): 78. doi:10.1109/MC.2012.57 (http://dx.doi.org/10.1109%2FMC.2012.57). Retrieved 23 March 2013.

10. ^ Press release announcing JavaScript (http://web.archive.org/web/20070916144913/http://wp.netscape.com/newsref/pr/newsrelease67.html), "Netscape and Sun announce Javascript", PR Newswire, December 4, 1995 11. ^ "TechVision: Innovators of the Net: Brendan Eich and JavaScript" (http://web.archive.org/web/20080208124612/http://wp.netscape.com/comprod/columns/techvision/innovators_be.html). Web.archive.org. Archived from the original (http://wp.netscape.com/comprod/columns/techvision/innovators_be.html) on 2008-02-08. 12. ^ "Programming languages used on the Internet and the World Wide Web (WWW)" (http://www.webdevelopersnotes.com/basics/languages_on_the_internet.php3). Webdevelopersnotes.com. Retrieved 2009-05-19. 13. ^ "O'Reilly - Safari Books Online - 0596101996 - JavaScript: The Definitive Guide, 5th Edition" (http://safari.oreilly.com/0596101996/jscript5CHP-1). Safari.oreilly.com. Retrieved 2009-05-19. 14. ^ "Chapter 2: Getting Started" (http://docs.oracle.com/cd/E19957-01/816-6411-10/getstart.htm). Server-Side JavaScript Guide. Netscape Communications Corporation. 1998. Retrieved 2012-04-25. 15. ^ Mike Morgan (1996). "Chapter 6: Netscape Internet Application Framework" (http://vampire.rulez.org/onlinedoc/book/NetscapeLiveWire/ch6.htm). Using Netscape LiveWire, Special Edition. Que. 16. ^ "Server-Side Javascript: Back With a Vengeance" (http://www.readwriteweb.com/archives/serverside_javascript_back_with_a_vengeance.php). Read Write Web. December 17, 2009. Retrieved May 28, 2012. 17. ^ "Node's goal is to provide an easy way to build scalable network programs" (http://nodejs.org/about/). About Node.js. Joyent. 18. ^ a b Brendan Eich (3 April 2008). "Popularity" (http://brendaneich.com/2008/04/popularity/). Retrieved 2012-01-19. 19. ^ "ECMAScript 3rd Edition specification" (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf) (PDF). Retrieved 2013-05-26. 20. ^ "Standard ECMA-262" (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf) (PDF). Retrieved 2013-05-26. 21. ^ "JavaScript: The World's Most Misunderstood Programming Language" (http://www.crockford.com/javascript/javascript.html). Crockford.com. Retrieved 2009-05-19. 22. ^ Kris Kowal (1 December 2009). "CommonJS effort sets JavaScript on path for world domination" (http://arstechnica.com/web/news/2009/12/commonjs-effort-sets-javascript-on-path-for-world-domination.ars). Ars Technica. Cond Nast Publications. Retrieved 18 April 2010. 23. ^ "USPTO Copyright entry #75026640" (http://tarr.uspto.gov/servlet/tarr?regser=serial&entry=75026640). USPTO. 24. ^ "Sun Trademarks" (http://www.sun.com/suntrademarks/). Sun Microsystems. Retrieved 2007-11-08. 25. ^ Flanagan & Ferguson 2006, p. 16. 26. ^ Flanagan & Ferguson 2006, pp. 176178. 27. ^ "Properties of the Function Object" (http://es5.github.com/#x15.3.4-toc). Es5.github.com. Retrieved 2013-05-26. 28. ^ Flanagan & Ferguson 2006, p. 141. 29. ^ "Inheritance and the prototype chain" (https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Inheritance_and_the_prototype_chain). Mozilla Developer Network . Mozilla. Retrieved 6 April 2013. 30. ^ Herman, David (2013). Effective Javascript. Addison-Wesley. p. 83. ISBN 9780321812186. 31. ^ Haverbeke, Marjin (2011). Eloquent Javascript. No Starch Press. pp. 9597. ISBN 9781593272821. 32. ^ Katz, Yehuda. "Understanding "Prototypes" in JavaScript" (http://yehudakatz.com/2011/08/12/understanding-prototypes-in-javascript/). Retrieved 6 April 2013. 33. ^ Herman, David (2013). Effective Javascript. Addison-Wesley. pp. 125127. ISBN 9780321812186. 34. ^ Haverbeke, Marijn (2011). Eloquent JavaScript. No Starch Press. pp. 139149. ISBN 978-1593272821. 35. ^ Robert Nyman, Getters And Setters With JavaScript Code Samples And Demos (http://robertnyman.com/2009/05/28/getters-and-setterswith-javascript-code-samples-and-demos/), published 29 May 2009, accessed 2 January 2010. 36. ^ John Resig, JavaScript Getters and Setters (http://ejohn.org/blog/javascript-getters-and-setters/), 18 July 2007, accessed 2 January 2010 37. ^ "MDN - About this Reference" (https://developer.mozilla.org/en/JavaScript/Reference/About#JavaScript_history). Developer.mozilla.org. 2008-08-31. Retrieved 2009-05-19. 38. ^ "var - JavaScript - MDN" (https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/var). The Mozilla Developer Network. Retrieved 22 December 2012. 39. ^ "ECMAScript Language Specification - ECMA-262 Edition 5.1" (http://www.ecma-international.org/ecma-262/5.1/#sec-4). Ecma International. Retrieved 22 December 2012. 40. ^ "console" (https://developer.mozilla.org/en-US/docs/DOM/console). Mozilla Developer Network . Mozilla. Retrieved 6 April 2013. 41. ^ "arguments" (https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Functions_and_function_scope/arguments). Mozilla Developer Network . Mozilla. Retrieved 6 April 2013. 42. ^ "JavaScript tracking - Piwik" (http://piwik.org/docs/javascript-tracking/). Piwik. Retrieved 31 March 2012. 43. ^ Hamilton, Naomi (2008-06-31). "The A-Z of Programming Languages: JavaScript" (http://www.computerworld.com.au/article/255293/z_programming_languages_javascript). computerworld.com.au. 44. ^ Peter-Paul Koch, Object detection (http://www.quirksmode.org/js/support.html) 45. ^ Peter-Paul Koch, Mission Impossible - mouse position (http://www.evolt.org/node/23335) 46. ^ Peter-Paul Koch, Browser detect (http://www.quirksmode.org/js/detect.html) 47. ^ a b c Flanagan & Ferguson 2006, pp. 262263. 48. ^ "Creating Accessible JavaScript" (http://www.webaim.org/techniques/javascript/). WebAIM. Retrieved 8 June 2010. 49. ^ "Making JavaScript Safe for Advertising" (http://www.adsafe.org/). ADsafe. Retrieved 2013-05-26. 50. ^ "Secure ECMA Script (SES)" (http://code.google.com/p/es-lab/wiki/SecureEcmaScript). Code.google.com. Retrieved 2013-05-26. 51. ^ MozillaZine, Mozilla Cross-Site Scripting Vulnerability Reported and Fixed (http://www.mozillazine.org/talkback.html?article=4392) 52. ^ Right-click "protection"? Forget about it (http://blog.anta.net/2008/06/17/right-click-%e2%80%9cprotection%e2%80%9d-forget-about-it/). 2008-06-17. ISSN 1797-1993 (//www.worldcat.org/issn/1797-1993). Retrieved 2008-06-17. 53. ^ Mozilla Corporation, Buffer overflow in crypto.signText() (http://www.mozilla.org/security/announce/2006/mfsa2006-38.html) 54. ^ Paul Festa, CNet, Buffer-overflow bug in IE (http://archive.is/20120724070835/http://news.com.com/2100-1001-214620.html) 55. ^ SecurityTracker.com, Apple Safari JavaScript Buffer Overflow Lets Remote Users Execute Arbitrary Code and HTTP Redirect Bug Lets Remote Users Access Files (http://securitytracker.com/alerts/2006/Mar/1015713.html)

56. ^ SecurityFocus, Microsoft WebViewFolderIcon ActiveX Control Buffer Overflow Vulnerability (http://www.securityfocus.com/bid/19030/info) 57. ^ Fusion Authority, Macromedia Flash ActiveX Buffer Overflow (http://www.fusionauthority.com/security/3234-macromedia-flash-activexbuffer-overflow.htm) 58. ^ Mike Friedman, Protected Mode in Vista IE7 (http://blogs.msdn.com/ie/archive/2006/02/09/528963.aspx) 59. ^ US CERT, Vulnerability Note VU#713878: Microsoft Internet Explorer does not properly validate source of redirected frame (https://www.kb.cert.org/vuls/id/713878) 60. ^ Mozilla Foundation, Mozilla Foundation Security Advisory 2005-41: Privilege escalation via DOM property overrides (http://www.mozilla.org/security/announce/2005/mfsa2005-41.html) 61. ^ Microsoft Corporation, Changes to Functionality in Microsoft Windows XP Service Pack 2: Part 5: Enhanced Browsing Security (http://technet.microsoft.com/en-us/library/bb457150.aspx#EHAA) 62. ^ For one example of a rare JavaScript Trojan Horse, see Symantec Corporation, JS.Seeker.K (http://www.symantec.com/security_response/writeup.jsp?docid=2003-100111-0931-99) 63. ^ "JavaScript for Acrobat" (http://www.adobe.com/devnet/acrobat/javascript.html). Retrieved 2009-08-18. 64. ^ Re-Animator (https://launchpad.net/reanimator), in Launchpad 65. ^ "Unity Scripting" (http://unity3d.com/unity/workflow/scripting). unity3d.com. Retrieved 2013-01-29. 66. ^ "Technical Specification" (http://www.dxstudio.com/features_tech.aspx). dxstudio.com. Retrieved 2009-10-20. 67. ^ THINK! The Maxwell Render Resourcer Center, Scripting References (http://think.maxwellrender.com/scripting_references-269.html) 68. ^ Google Apps Script, Welcome to Google Apps Script (http://www.google.com/google-d-s/scripts/scripts.html) 69. ^ "ChatZilla! Frequently Asked Questions - 4.5. How do I write scripts?" (http://chatzilla.hacksrus.com/faq/#scripts). Hacksrus.com. Retrieved 11 February 2011. 70. ^ "http://unborn.ludost.net/xcdscript/" (http://unborn.ludost.net/xcdscript/). Retrieved 11 February 2011. 71. ^ "JavaScript - SpinetiX Support Wiki" (http://support.spinetix.com/wiki/JavaScript). SpinetiX. Retrieved 12 December 2012. 72. ^ "Scripting Overview - Cloud Party Wiki" (http://wiki.cloudparty.com/wiki/Scripting_Overview). Cloud Party, Inc. Retrieved 7 January 2013. 73. ^ "Version Information (JavaScript)" (http://msdn.microsoft.com/en-us/library/s4esdbwz(v=VS.94).aspx). Msdn.microsoft.com. Retrieved 2013-05-26. 74. ^ "javax.script release notes" (http://java.sun.com/javase/6/webnotes/index.html#scripting). Java.sun.com. Retrieved 2009-05-19. 75. ^ Flanagan & Ferguson 2006, pp. 214 et seq. 76. ^ Nokia Corporation, QtScript Module (http://doc.qt.nokia.com/4.6/qtscript.html) 77. ^ JSDB.org (http://www.jsdb.org/) (Official website) 78. ^ jslibs (https://code.google.com/p/jslibs/) on Google Code 79. ^ Open Scripting Architecture 80. ^ "Behind the Scenes with Owen Taylor" (http://gnomejournal.org/article/74/behind-the-scenes-with-owen-taylor). The GNOME Journal. Retrieved 2010-01-23. 81. ^ "Answering the question: "How do I develop an app for GNOME?"" (http://treitter.livejournal.com/14871.html). 82. ^ Category: Project's basics (2013-05-22). "myNFC.org" (http://www.mynfc.org/). myNFC.org. Retrieved 2013-05-26. 83. ^ "Advanced Debugging With JavaScript" (http://www.alistapart.com/articles/advanced-debugging-with-javascript/). alistapart.com. 2009-0203. Retrieved 2010-05-28. 84. ^ "The JavaScript Debugging Console" (http://javascript.about.com/od/problemsolving/ig/JavaScript-Debugging/). javascript.about.com. 201005-28. Retrieved 2010-05-28. 85. ^ "SplineTech JavaScript Debugger - an independent standalone JavaScript Debugger" (http://www.javascript-debugger.com). javascripdebugger.com. 2013-08-26. Retrieved 2013-08-26. 86. ^ JScript development in Microsoft Office 11 (http://msdn2.microsoft.com/en-us/library/aa202668(office.11).aspx) (MS InfoPath 2003) 87. ^ "Opera DragonFly" (http://www.opera.com/dragonfly/). Opera Software. 88. ^ "Introducing Drosera - Surfin' Safari" (http://webkit.org/blog/61/introducing-drosera/). Webkit.org. 2006-06-28. Retrieved 2009-05-19. 89. ^ "JavaScript - JScript - ECMAScript version history" (http://www.webmasterworld.com/forum91/68.htm). Webmasterworld.com. Retrieved 2009-12-17. 90. ^ John Resig. "Versions of JavaScript" (http://ejohn.org/blog/versions-of-javascript). Ejohn.org. Retrieved 2009-05-19. 91. ^ "Version Information (JScript)" (http://msdn.microsoft.com/library/default.asp?url=/library/enus/script56/html/js56jsoriversioninformation.asp). Msdn.microsoft.com. Retrieved 2009-12-17. 92. ^ "History of the Opera web browser" (http://en.wikipedia.org/wiki/History_of_the_Opera_web_browser#Version_3). 93. ^ "What Version of Javascript" (http://javascript.about.com/library/bljver.htm). 94. ^ Release Notes for the Next-Generation Java Plug-In Technology (introduced in Java SE 6 update 10) (http://java.sun.com/javase/6/webnotes/6u10/plugin2/liveconnect/). Java.sun.com. Retrieved on 2013-06-13. 95. ^ "New in JavaScript 1.7" (https://developer.mozilla.org/en/New_in_JavaScript_1.7#Array_comprehensions_%28Merge_into_Array_comprehensions%29). Developer.mozilla.org. 2012-12-05. Retrieved 2013-05-26.

Further reading
Bhangal, Sham; Jankowski, Tomasz (2003). Foundation Web Design: Essential HTML, JavaScript, CSS, PhotoShop, Fireworks, and Flash. APress L. P. ISBN 1-59059-152-6. Burns, Joe; Growney, Andree S. (2001). JavaScript Goodies. Pearson Education. ISBN 0-7897-2612-2. Duffy, Scott (2003). How to do Everything with JavaScript. Osborne. ISBN 0-07-222887-3. Flanagan, David; Ferguson, Paula (2006). JavaScript: The Definitive Guide (5th ed.). O'Reilly & Associates. ISBN 0-596-10199-6. Goodman, Danny; Eich, Brendan (2001). JavaScript Bible. John Wiley & Sons. ISBN 0-7645-3342-8. Goodman, Danny; Markel, Scott (2003). JavaScript and DHTML Cookbook . O'Reilly & Associates. ISBN 0-596-00467-2.

Harris, Andy (2001). JavaScript Programming for the Absolute Beginner. Premier Press. ISBN 0-7615-3410-5. Haverbeke, Marijn (2011). Eloquent JavaScript. No Starch Press. ISBN 978-1593272821. Heinle, Nick; Koman, Richard (1997). Designing with JavaScript. O'Reilly & Associates. ISBN 1-56592-300-6. McDuffie, Tina Spain (2003). JavaScript Concepts & Techniques: Programming Interactive Web Sites. Franklin, Beedle & Associates. ISBN 1887902-69-4. McFarlane, Nigel (2003). Rapid Application Development with Mozilla. Prentice Hall Professional Technical References. ISBN 0-13-142343-6. Powell, Thomas A.; Schneider, Fritz (2001). JavaScript: The Complete Reference. McGraw-Hill Companies. ISBN 0-07-219127-9. Shelly, Gary B.; Cashman, Thomas J.; Dorin, William J.; Quasney, Jeffrey J. (2000). JavaScript: Complete Concepts and Techniques. Cambridge: Course Technology. ISBN 0-7895-6233-2. Vander Veer, Emily A. (2004). JavaScript For Dummies (4th ed.). Wiley Pub. ISBN 0-7645-7659-3. Watt, Andrew H.; Watt, Jonathan A.; Simon, Jinjer L. (2002). Teach Yourself JavaScript in 21 Days. Pearson Education. ISBN 0-672-32297-8.

External links
JS Beginner's tutorial (http://referencedesigner.com/tutorials/js/js_1.php) Codeacademy's JavaScript Track (http://www.codecademy.com/tracks/javascript) Douglas Crockford's video lectures on JavaScript (http://yuiblog.com/crockford/) Douglas Crockford's A Survey of the JavaScript Programming Language (http://javascript.crockford.com/survey.html) Mozilla Developer Center Mozilla's Official Documentation on JavaScript (https://developer.mozilla.org/en/JavaScript) References for Core JavaScript versions: 1.5+ (https://developer.mozilla.org/en/JavaScript/Reference) overview over new features in JavaScript (https://developer.mozilla.org/en/JavaScript/New_in_JavaScript) List of JavaScript releases: versions 1.5+ (https://developer.mozilla.org/en/JavaScript/Reference/About) Re-Introduction to JavaScript (https://developer.mozilla.org/en/A_re-introduction_to_JavaScript) Eloquent JavaScript (http://eloquentjavascript.net/) by Marijn Haverbekea free, Creative Commonslicensed eBook JavaScript (http://dev.opera.com/articles/javascript/)Opera Developer Community List of languages that compile to JS (https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS/) Retrieved from "http://en.wikipedia.org/w/index.php?title=JavaScript&oldid=573350648" Categories: 1995 introductions American inventions Cross-platform software Functional languages JavaScript Object-based programming languages Programming languages created in 1995 Prototype-based programming languages Scripting languages Web programming This page was last modified on 17 September 2013 at 16:36. Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.

Vous aimerez peut-être aussi