JavaScript history and overview
Objectives
- discuss history of JavaScript
- describe JavaScript capabilities
- describe JavaScript limitations
- discuss what Ajax is and why it is useful
History of JavaScript
- JavaScript was created at Netscape by Brendan Eich in 1995.
- JavaScript was originally named Mocha, and then LiveScript, before becoming JavaScript.
- JavaScript is NOT Java - although is shares some of the same syntax as Java.
- Java was a very popular buzzword at the time JavaScript got its common name, leading many to believe it was an attempt to capitalize on the popularity of Java.
- The standards version of JavaScript is named ECMAScript [ECMA = European Computer Manufacturers Association].
- Microsoft's version of JavaScript is named JScript.
- Adobe's Actionscript (found in Flash and Flex) is a relative which is derived from ECMAScript.
- The new HTML5 standard assumes a new standard version of JavaScript which extends and standardizes many browser features, and adds a number of new features and capabilities to the JavaScript language.
- ECMAScript 6 was a major update to language features made after a long period of relative stability
- The plan is to have frequent (annual) updates to the ECMAScript standard and name them with year numbers, so ECMAScript 6 is also ECMAScript 2015,
ECMAScript 7 is also ECMAScript 2016, etc.
- ECMAScript 7 (2016) has only a small number of changes
- Browser differences used to make cross-browser JavaScript code more difficult than it is now. Increased standardization and available JavaScript libraries make that task easier now.
- Ajax is now used to request and update webpages with server data without having to reload the page, increasing responsiveness and potentially decreasing network traffic.
- Many JavaScript frameworks are available to add functionality, special effects, and make make cross-browser scripting easier.
Uses/capabilities of JavaScript
- create dynamic pages on the fly
- enable "rollovers"
- create simple interactive "calculators"
- animate images
- create slideshows
- use cookies
- validate form data
- open new windows
- work with dates and times
- modify the contents of child windows and frames
- create nifty graphics effects such as expandable/collapsible sections
of documents, fade-in/fade-out effects, etc.
- using Ajax, JavaScript can also be used to update web page content
without having to reload a web page
- Relatively new feature: greatly improved control of audio and video content
- Relatively new feature: improved integration for Ajax communication through native JSON support
- Relatively new feature: ability to draw on a canvas element
- Relatively new feature: greatly expanded client-side storage capability using localStorage and sessionStorage
- Relatively new feature: access to browser geolocation features
- Relatively new feature: ability to create multithreaded applications for greater efficiency (not well supported yet)
Limitations
- A script can't close windows it didn't open.
- A script can't read info from a window it didn't open.
- There is normally no explicit file access (either read or write) on the client machine.
- Restricted resources (such as files) can be accessed through ActiveX controls.
- There are some other ways to access files on the local machine, but they are not common
yet and will not be covered in this course - they require extensions beyond basic JavaScript.
- Since your code is run by the user's web browser, it is dependent on the user's browser.
- There are slight JavaScript differences between browsers.
- A user can turn JavaScript off in their browser.