I’ve spent quite a long time coding and searching this and other sites with no success. I have a GWT app that calls into JSNI which then calls into an Applet to perform some file loading. So I need to be called back when the file loading has completed. Try as I might, I can’t get my JavaScript (or Java) callback to be invoked. Normally you refer to the $wnd variable something like this:
$wnd.myFunc()
If I try this (or tons of other variations I thought might work), it silently fails. I can’t even call something simple like:
$wnd.alert("Made it")
I’ve tried using window.eval("$wnd.myFunc()");
I’ve also tried window.call with the same results.
I’m guessing that I’m in the wrong context (GWT places everything in an IFrame), but I can’t find any option to get access to the global context where GWT is supposed to place "$wnd" variables.
IFrames are supposed to be somewhat constrained for security reasons and I’m wondering if I’m running into something that has been intentionally disabled.
Anyway, a lot of guesswork on my part, but my knowledge of JavaScript is limited, so perhaps I’m overlooking something simple.
I finally solved my own problem. Here’s a quick synopsis of a method that works:
This is the applet insertion code:
Here’s the Java call back and JSNI:
The applet code to call the Java callback: