开发者

How can I access the JavaScript global object ("window") inside an embedded browser object (the IWebBrowser2 interface)?

开发者 https://www.devze.com 2023-02-04 15:16 出处:网络
I have an HTML page which embeds an IWebBrowser2 ActiveX (i.e. the control is essentially an Internet Explorer browser). I need to write JavaScript in this HTML page which will remove any window.onres

I have an HTML page which embeds an IWebBrowser2 ActiveX (i.e. the control is essentially an Internet Explorer browser). I need to write JavaScript in this HTML page which will remove any window.onresize handler from the page loaded in the IWebBrowser2 control.

IWebBrowser2 exposes the DOM through IWebBrowser2::Document, but this is equivalent to window.document. Is there any way I can get access to window or window.onres开发者_如何学JAVAize?


You should be able to use document.parentWindow:

var controlWindow = control.document.parentWindow;
0

精彩评论

暂无评论...
验证码 换一张
取 消