Java Reference
In-Depth Information
Javascript and the Web
For most of this topic you look at JavaScript code that runs inside a web page loaded into a browser.
All you need to create these web pages is a text editor—for example, Windows Notepad—and a web
browser, such as Chrome, Firefox, or Internet Explorer (IE), with which you can view your pages.
These browsers come equipped with JavaScript interpreters (more commonly known as JavaScript
engines).
Note Throughout this topic, we use the terms “IE” and “Internet Explorer”
interchangeably when referring to Microsoft's Internet Explorer browser.
In fact, the JavaScript language first became available in Netscape's Navigator 2. Initially, it was
called LiveScript, but because Java was the hot technology of the time, Netscape decided that
JavaScript sounded more exciting. When JavaScript really took off, Microsoft decided to add its
own dialect of JavaScript, called JScript, to Internet Explorer 3.
In 1997, JavaScript was standardized by Ecma International, a membership‐based non‐profit
organization, and renamed to ECMAScript. Today's browser makers look to the ECMAScript
standard to implement the JavaScript engines included in their respective browsers, but that doesn't
necessarily mean that all browsers support the same features. JavaScript support among today's
browsers is certainly more unified than it has ever been, but as you see in future chapters, developers
still have to cope with older, and in many cases non‐standard, JavaScript implementations.
The ECMAScript standard controls various aspects of the language and helps ensure that different
versions of JavaScript are compatible. However, although Ecma sets standards for the actual
language, it doesn't specify how it's used in particular hosts. By host , we mean hosting environment;
in this topic, that is the web browser. Other hosting environments include PDF iles, web servers,
and many, many other places. In this topic, we discuss only its use within the web browser. The
organization that sets the standards for web pages is the World Wide Web Consortium (W3C). It
not only sets standards for HTML and CSS, but also for how JavaScript interacts with web pages
inside a web browser. You learn much more about this in later chapters of the topic. Initially, you'll
look at the essentials of JavaScript before the more advanced stuff. In the appendices of this topic,
you'll find useful guides to the JavaScript language and how it interacts with the web browser.
The majority of the web pages containing JavaScript that you create in this topic can be stored on
your hard drive and loaded directly into your browser from the hard drive itself, just as you'd load
any normal file (such as a text file). However, this is not how web pages are loaded when you browse
websites on the Internet. The Internet is really just one great big network connecting computers.
Access to websites is a special service provided by particular computers on the Internet; the
computers providing this service are known as web servers .
Basically, the job of a web server is to hold lots of web pages on its hard drive. When a browser,
usually on a different computer, requests a web page contained on that web server, the web server
loads it from its own hard drive and then passes the page back to the requesting computer via
a special communications protocol called Hypertext Transfer Protocol (HTTP) . The computer
 
Search WWH ::




Custom Search