MatBanik
MatBanik

Reputation: 26860

gwt - access from iframe page

mainpage.html

<html>
<div id="123" name="foo"></div>
<iframe src="/innerpage.html"></iframe>
</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?

Upvotes: 1

Views: 1149

Answers (2)

Abdullah Jibaly
Abdullah Jibaly

Reputation: 54790

Using jsni you can do this:

iframe accessing parent DOM?

Upvotes: 1

Brad Gardner
Brad Gardner

Reputation: 1627

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.

Upvotes: 1

Related Questions