views:

155

answers:

1

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?

+1  A: 

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)

Matt
I really don't wanna have all the hassle of supporting an outdate technology (MSJVM) but it's not my choice.I think live connect is pretty new, so it's not an option to support MS.but JSObject can be used for sure, but I don't know what's the problem with the javascript returning undefined with MSJVM.
Bassel Alkhateeb
with the compiler it's not that hard targeting 1.1 if you didn't use any newer libraries.
Bassel Alkhateeb
MS JVM has been out of support for some time now. Even after the deadline was extended once or twice. What is the restriction you have on not using a sun JRE?
Knife-Action-Jesus