I have an iframe that contains GWT code. I'd like from that code to dynamically change the iframe dimensions.
I'm trying the following:
Element iframe = we start from some element inside the iframe;
while (!iframe.getTagName().toLowerCase().equals("iframe")) { // get embedding iframe
iframe = iframe.getParentElement();
}
iframe.setAttribute("style", "height:100px;width:100px;");
It doesn't work. Somewhere in the middle I reach a null parent before getting to the iframe.
How can I change the iframe dimensions from GWT that runs within the iframe itself? I don't mind if its a JSNI-based solution.
Thanks!
You can't do it. If the document inside the iFrame is in your domain, and the document which includes the iFrame is in a different domain, the security mechanism will prevent you from making any changes from one to the other.