Bassel Alkhateeb
Bassel Alkhateeb

Reputation: 1584

accessing Browser's javascript from Java applet with MS Internet Explorer

I'm using JSObject plugin to write a cookie through the java applet and it worked with SUN's Java.

but, With MS JVM the javascript command returning undefined

I'm issuing the following from my Applet:

String s1 = "document.cookie='logged=1'";
aobj = new Object[] { s1 };
JSObject.getWindow(MyAppletWindow).call("eval", aobj);

any clue?

Upvotes: 0

Views: 535

Answers (1)

Matt
Matt

Reputation: 44078

First, I'm not entirely certain the Microsoft VM supports LiveConnect, which is required for JavaScript<->Java communication.

Further, the Microsoft VM only supported up to version 1.1 of Java. It is severely outdated and most likely not loading your applet anyway (do you see the famous typo applet not inited in IE's status bar?). In fact, even if you were using only 1.1-compatible libraries.. if you're using a recent compiler, you would have to jump through some hoops to even make it loadable by a 1.1 VM:

javac -source 1.1 -target 1.1 Foo.java

In summary, the Microsft VM is very old and you should target the Sun VM instead (you can use an object tag to enforce this, read this article for more information)

Upvotes: 1

Related Questions