1

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?

Community
  • 1
  • 1
MatBanik
  • 26,356
  • 39
  • 116
  • 178

2 Answers2

1

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.

Brad Gardner
  • 1,627
  • 14
  • 14
1

Using jsni you can do this:

iframe accessing parent DOM?

Community
  • 1
  • 1
Abdullah Jibaly
  • 53,220
  • 42
  • 124
  • 197