Section 13.9. Other Web-Related JavaScript Embeddings


13.9. Other Web-Related JavaScript Embeddings

In addition to client-side JavaScript, the JavaScript language has other web-related embeddings. This book does not cover these other embeddings, but you should know enough about them so that you don't confuse them with client-side JavaScript:


User scripting

User scripting is an innovation in which user-defined scripts are applied to HTML documents before they are rendered by the browser. Rather than being solely under the control of the page author, web pages can now be controlled by the page visitor as well. The best-known example of user scripting is enabled by the Greasemonkey extension to the Firefox web browser (http://greasemonkey.mozdev.org). The programming environment exposed to user scripts is similar to, but not the same as, the client-side programming environment. This book will not teach you how to write Greasemonkey user scripts, but learning client-side JavaScript programming can be considered a prerequisite to learning user scripting.


SVG

SVG (Scalable Vector Graphics) is an XML-based graphics format that permits embedded JavaScript scripts. Client-side JavaScript can script the HTML document within which it is embedded, and JavaScript code embedded in an SVG file can script the XML elements of that document. The material in Chapters 15 and 17 is relevant to SVG scripting but is not sufficient: the DOM for SVG differs substantially from the HTML DOM.

The SVG specification is at http://www.w3.org/TR/SVG. Appendix B of this specification defines the SVG DOM. Chapter 22 uses client-side JavaScript embedded in an HTML document to create an SVG document that is embedded in an HTML document. Since the JavaScript code is outside the SVG document, this is an example of regular client-side JavaScript rather than SVG embedding of JavaScript.


XUL

XUL is an XML-based grammar for describing user interfaces. The GUI of the Firefox web browser is defined with XUL documents. Like SVG, the XUL grammar allows JavaScript scripts. As with SVG, the material in Chapters 15 and 17 is relevant to XUL programming. However, JavaScript code in a XUL document has access to different objects and APIs, and is subject to a different security model than client-side JavaScript code. Learn more about XUL at http://www.mozilla.org/projects/xul and http://www.xulplanet.com.


ActionScript

ActionScript is a JavaScript-like language (descended from the same ECMAScript specification but evolved in an object-oriented direction) used in Flash movies. Most of the core JavaScript material in Part I of this book is relevant to ActionScript programming. Flash is not XML- or HTML-based, and the APIs exposed by Flash are unrelated to those discussed in this book. This book includes examples of how client-side JavaScript can script Flash movies in Chapters 19, 22, and 23. These examples necessarily include small snippets of ActionScript code, but the focus is on the use of regular client-side JavaScript to interact with that code.




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net