gwt - access from iframe page
mainpage.html
<html>
<div id="123" name="foo"></div>
<iframe src="/innerpage.html"></iframe&g开发者_高级运维t;
</html>
innerpage.html:
<html>
and here is some GWT widget that needs to access the div with id="123":
DOM.getElementById("123").getAttribute("name")
</html>
Is it possible to access the div on mainpage within the inner page?
Using jsni you can do this:
iframe accessing parent DOM?
You should be able to do this using parent.getElementById("123");
Note that the innerpage and mainpage will likely need to be within the same domain to prevent this getting flagged as cross-site scripting.
精彩评论