JS call from applet works in Firefox and Chrome, but not in Safari

I have the following code in the applet to call some Javascript (it is a bit confusing because the fn that is being called gets the object from the DOM identified by divId and calls the function on it).

@Override
public final void start() {
  System.err.println("start() method called");
  this.javascript = JSObject.getWindow(this);
  this.jsObjectDivId = getParameter("parent_div_id");
  this.initCallbackFnName = getParameter("init_callback");
  Object args[] = {this.jsObjectDivId, this.initCallbackFnName};
  System.out.print("Calling init_callback\n");
  this.javascript.call("callJS", args);
}

Function callJS:

window.callJS = function(divId, functionName, jsonArgString) {
  var args, obj;
  obj = $(divId).data('neatObject');
  args = eval(jsonArgString);
  return obj[functionName](args);
};

In Firefox / Chrome, the arguments divIdand functionNamecontain valid strings, and everything works fine; the required function is called for an object that depends on the specified DIV data.

In Safari, arguments divIdand are functionNamereported as JavaRuntimeObjectwith values true.

> divId
  JavaRuntimeObject
    true

What gives?

+2
source share
2 answers

LiveConnect . Safari Java JS Prober call. eval Applet call JSON . - :

javascript.eval(callback + "({\"id\":\"" + id + "\",\"... })")

, - LiveConnect. , : http://blog.aarhusworks.com/applets-missing-information-about-liveconnect-and-deployment/

LiveConnect, : http://www.jdams.org/live-connect-test

+4

Safari. JavaRuntimeObject, - , .

@edoloughlin, (applet.getMethod() + ""), .

, , .

0

All Articles