Chapter 22. Using Java with JavaScript
As we discussed in Chapter 14,
Netscape 3 and
later and Internet Explorer 4 and later both allow JavaScript
programs to read and write the public fields and invoke the public
methods of Java applets embedded in HTML documents. Netscape supports
JavaScript interaction with Java applets through a technology known
as LiveConnect. Internet Explorer instead treats every Java
object (including applets) as an ActiveX control and uses its ActiveX
scripting technology to allow JavaScript programs to interact with
Java. Because Netscape's technology is specifically designed
for communication between JavaScript and Java, it has some features
that IE's ActiveX technology cannot provide. In practice,
however, the two technologies are fairly compatible. Although this
chapter is based on Netscape's LiveConnect, the key features it
describes work in IE as well.[1]
[1] Note that Netscape 6
was released with poor support for LiveConnect but that it is fully
implemented in Netscape 6.1 and later. This chapter begins with a discussion of how you can use JavaScript
to script Java applets, how your Java applets can invoke JavaScript
code, and how (in Netscape only) you can use JavaScript to work
directly with Java system classes. It then documents the nitty-gritty
details of how LiveConnect works. It assumes you have at least a
basic familiarity with Java programming (see Java in a
Nutshell , by David Flanagan, and Learning
Java , by Patrick Niemeyer and Jonathan Knudsen, both
published by O'Reilly).
•
Table of Contents
•
Index
•
Reviews
•
Examples
•
Reader Reviews
•
Errata
JavaScript: The Definitive Guide, 4th Edition
By
David Flanagan
Publisher
: O'Reilly
Pub Date
: November 2001
ISBN
: 0-596-00048-0
Pages
: 936
Slots
: 1
This fourth edition of the definitive reference to
JavaScript, a scripting language that can be embedded
directly in web pages, covers the latest version of the
language, JavaScript 1.5, as supported by Netscape 6 and
Internet Explorer 6. The book also provides complete
coverage of the W3C DOM standard (Level 1 and Level 2),
while retaining material on the legacy Level 0 DOM for
backward compatibility.