Calling Js From An Applet Works In Firefox & Chrome But Not Safari
Solution 1:
LiveConnect is not fully supported in all browsers. Especially, Safari doesn't convert Java Strings to the prober JS equivalent when using call
. In your case you can just use eval
at the Applet side instead of call
and put in a JSON string object with the arguments. Something like:
javascript.eval(callback + "({\"id\":\"" + id + "\",\"
... })")
Basically, you need to know the cross-browser compatible subset of LiveConnect that works. I've written a blog post that describes the subset: http://blog.aarhusworks.com/applets-missing-information-about-liveconnect-and-deployment/
It comes with a LiveConnect test suite which runs in the browser: http://www.jdams.org/live-connect-test
Solution 2:
I had a similar issue with calling a method on an applet in Safari. It was returning a JavaRuntimeObject that I caused an exception when it was user later on.
As pointed out by @edoloughlin I had to use (applet.getMethod() + "") after which point the proper string was evaluated.
The comment saved me a bunch of time so I thought it useful to add here as I can't comment above.
Post a Comment for "Calling Js From An Applet Works In Firefox & Chrome But Not Safari"