I’d like to know how to call a GWT static method from the parent of the iframe in which the gwt module is loaded.
As a simple example suppose I have the following gwt class:
public class Simple {
public static void showWindow() {
Window.alert("Hello from the iframe");
}
}
I create an html host page called “iFrameHost.html” that can run the function above. Then in an unrelated GWT module on a different page I call:
Frame iFrame = new Frame("iFrameHost.html");
RootPanel.get().add(iFrame);
How do I now call the showWindow() method from the parent page?
This is based on Gipsy King’s answer:
Simple Class becomes:
Then to call the Simple class from the parent HTML page:
Set the IFrame id and use the following method:
You’ll have to make certain that the iFrame page has called setWindowFunction() but after that you can call callShowWindow() from the parent html page.