final html.IFrameElement iframe = rootDemoElement.querySelector("iframe");
final int contentHeight = <???>.scrollHeight;
这适用于JS:
var contentHeight = iframe.contentDocument.documentElement.scrollHeight;
在Dart中没有contentDocument Dart中是否真的可能缺少contentDocument?
答案 0 :(得分:1)
据我所知,有人试图让Dart在浏览器中比JavaScript更安全,这导致了一个跨窗口通信受限的模型(对于postMessage)。我假设Iframe受到同样的限制。他们想要留下这个策略的问题有一个评论,因为这通常是通过使用dart-js-interop进行环绕。
我认为主要的罪魁祸首是你获得_DOMWindowCrossFrame
而不是Window
个实例。
见
可能还有相关的
答案 1 :(得分:1)
这是我的解决方案:
var jsIFrame = new JsObject.fromBrowserObject(iframe);
var contentHeight = jsIFrame["contentDocument"]["documentElement"]["scrollHeight"];