I have a html, say A.html. I am invoking A.html inside of A.html inside an IFRAME.
A.html
<html>
.....
<IFRAME>
A.html (same domain, etc as A.html)
</IFRAME>
</html>
This is a GWT app. This IFRAME is a popup, and when the user closes (clicks a close button) this popup (which is also loading the A.html as you can see above), I want to
fire an event to display some message on the outer A.html which means I need an access to codes outside of IFRAME. How can I achieve this?
Thanks
Since your iframe contents are being loaded from the same domain, you can call javascript functions on the containing page. I’m assuming that you’re asking about calling the code outside the iframe from GWT. If so, then you can use JSNI.
For example, given the JSNI method:
You could call the method within a GWT ClickHandler:
This assumes a function defined using javascript in the containing page, for instance:
Note: If the iframe contents are loaded from a different domain, you can achieve the same result using postMessage.