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?
source
share