please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 19
LiveConnect: JavaScript and Java
Next
 

19.7 Working with Java in Internet Explorer

Internet Explorer 3.0 does not support LiveConnect. Instead, it treats Java applets as ActiveX objects and allows JavaScript to interact with them through that mechanism. This gives Internet Explorer some, but not all, of the capabilities of LiveConnect.

Interacting with Applets

Internet Explorer 3.0 can invoke the public methods of Java applets and can read and write the values of public fields of Java applets, in much the same way that Navigator 3.0 can. Although the underlying mechanism is different, the basic syntax is the same:

document.appletname.property
document.appletname.method(...)

The data conversion that occurs when Internet Explorer passes values back and forth to Java follows ActiveX's rules, and is not documented here.

There are a couple of restrictions on IE 3.0 interactions with applets. First, note that it does not support the applets[] array of the Document object. So if you want to read or write properties or invoke methods of an applet, you must call the applet by name, and you must assign a name to the applet with the NAME attribute of the <APPLET> tag.

Second, note the Internet Explorer can only read and write properties and invoke methods of the applet object itself. IE does not have an equivalent to the LiveConnect JavaObject object, so if an applet has a property that refers to some other Java object, IE cannot read and write properties or invoke methods of that other object. To work around this shortcoming, you simply need to be sure that all functionality you need to access from JavaScript is implemented as a method of the applet, even if some of those methods do nothing more than invoke a method of some other object.

Third, Internet Explorer can only invoke the public instance methods of an applet. It has no mechanism for invoking with Java class methods.

Interacting with Plug-Ins and System Classes

Internet Explorer 3.0 can install and use Navigator plug-ins, but it does not allow JavaScript to interact with them in the way that Navigator does. Similarly, it does not have JavaPackage or JavaClass objects, and so has no way to read or write properties of system classes, invoke methods of system classes or create instances of system classes.

Calling JavaScript from Applets

Internet Explorer does not support the netscape.javascript.JSObject class, and does not allow Java applets to invoke JavaScript methods or read and write JavaScript properties.

Microsoft's ActiveX technology does allow Java applets in IE to interact with OLE objects embedded in a web page, as long as the applet is compiled so that it supports the desired object and as long as JavaScript passes a reference to the OLE control to the applet. Once JavaScript has told the applet where it can find the OLE control, any interaction occurs directly between the applet and the OLE object, without the intervention of JavaScript. This differs from the LiveConnect model in which an applet can use JavaScript as an intermediary to control any arbitrary applet or plug-in without special compilation being required to enable direct communication between the first applet and the other applet or plug-in.


Previous Home Next
Using JavaScript from Java Book Index Summary

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/java/script/definitive/ch19_07.htm, 7KB, , updated: 2019/10/14 15:00, local time: 2024/12/27 14:37,
TOP NEW HELP FIND: 
3.15.26.231:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://linistepper.com/techref/language/java/script/definitive/ch19_07.htm"> [Chapter 19] 19.7 Working with Java in Internet Explorer</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?