0
我有[对象HTMLIFrameElement]我想要它的文档。我宁愿不使用本地方法。这是我现在尝试的,但它doies不工作。如何在GWT中获取HTMLIFrameElement的Document对象
//This is iFrame container with iFrame
mainWidge = new MainWidgetViewImpl(base);
//This is HTMLIFrameElement
Element iframeElement = mainWidge.getElement().getFirstChildElement();
//I've tried this, but it gets null pointer exception
IFrameElement iframe = (IFrameElement)mainWidge.getElement().getFirstChildElement();
//Here is: "Cannot read property 'document' of null"
Document doc = iframe.getContentDocument();
我的目标是在显示之前注入到样式iframe的头部分。有没有办法做到这一点? – 2014-11-07 11:20:05
将iframe附加到文档并不一定意味着使其可见。 – 2014-11-07 13:00:57
这是某种解决方案。但我宁愿在onLoad事件之前注入这些样式。所以他们从一开始就是可用的。 – 2014-11-07 13:04:36