我有一个包含 GWT 代码的 iframe。我想从该代码中动态更改 iframe 尺寸。
我正在尝试以下操作:
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;");
它不起作用。在中间的某个地方,我在到达 iframe 之前到达了一个 null 父级。
如何从在 iframe 本身中运行的 GWT 更改 iframe 尺寸?我不介意它是否是基于 JSNI 的解决方案。
谢谢!