Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

LiveConnect provides JavaScript with the ability to call methods of Java classes and vice-versa using the existing Java infrastructure.

Older versions of Gecko included special support for the Java<->JavaScript bridge (such as the java and Packages global objects), but as of Mozilla 16 (Firefox 16 / Thunderbird 16 / SeaMonkey 2.13) LiveConnect functionality is provided solely by the Oracle's Java plugin.

Documentation

Java plugin - LiveConnect documentation
This is likely the most up-to-date documentation of LiveConnect.
Removal of java and Packages global objects in Mozilla 16
See bug 748343 for the rationale and workarounds. You can still embed Java applets and access their API from JavaScript.
LiveConnect Overview
An overview for Liveconnect.
LiveConnect reference
The Java classes used for LiveConnect, along with their constructors and methods.
Java in Firefox extensions

Community

  • View mozilla.dev.tech.java forums...

JavaScript, Plugins

Older notes

(Please update or remove as needed.)

While the bloated LiveConnect code in the Mozilla source was removed in version 1.9.2 of the platform (see bug 442399), its former API has been restored (see also the specification and this thread) (building on NPAPI?), and as of Java 6 update 12, extensions as well as applets can make use of this restored API. The reimplementation also restores the ability to use try-catch exceptions within JavaScript, and is free of the increasing number of other bugs introduced by the decline of the original LiveConnect (e.g., java.lang.String and arrays not working properly).

LiveConnect use by applets is enabled via the use of the "MAYSCRIPT" attribute in applet tags on an HTML page, following which the applet may refer to classes in the netscape.javascript package to access Javascript objects, and scripts may directly call applet methods (using the syntax document.applets.name.methodName()). Standard Java objects are also available for creation and manipulation by Javascript code (e.g. by writing code like "new java.lang.String('javascript string')" for classes in the java.* package hierarchy, or using a new "Packages" object for classes outside this hierarchy).

Java Method Overloading and LiveConnect 3
The technique that LiveConnect uses to invoke overloaded Java methods from JavaScript.
LiveConnect Exceptions
How do Java and JavaScript catch exceptions generated by the other party?
Liveconnect Testcases
Determine that applets within different html tags work properly.

 

NOTE:

LiveConnect Blocked under Some Conditions

LiveConnect calls from JavaScript to Java API are blocked when the Java Control Panel security slider is set to Very High level, or when the slider is at the default High level and the JRE has either expired or is below the security baseline.

Document Tags and Contributors

Tags: 
 Last updated by: fscholz,