积极答复者
c# winForm 使用WebBrowser游览网页,当网页有windows.close()时怎么办?

问题
-
winform程序使用webbrowser显示网页,当网页调用windows.close()时,会报错 对 COM 组件的调用返回了错误 HRESULT E_FAIL。
尝试使用DWebBrowserEvents2接口的WindowClosing方法,WindowClosing完全不会触发。
尝试当抛错时,新创建webbrowser,但是新创建的webbrowser不会显示出来。
请问大神们怎么办呢?
- 已移动 Sheng Jiang 蒋晟Moderator 2015年7月27日 1:21 非语言相关
答案
-
Hi 缄言,
在.NET基础类库的webbrowser不支持这项活动。为了处理事件,你需要直接访问的ActiveX.
"WebBrowser and javascript window.close()": http://stackoverflow.com/questions/5535575/webbrowser-and-javascript-window-close
Best Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 Barry WangModerator 2015年8月10日 9:18
全部回复
-
winform程序使用webbrowser显示网页,当网页调用windows.close()时,会报错 对 COM 组件的调用返回了错误 HRESULT E_FAIL。
尝试使用DWebBrowserEvents2接口的WindowClosing方法,WindowClosing完全不会触发。
尝试当抛错时,新创建webbrowser,但是新创建的webbrowser不会显示出来。
请问大神们怎么办呢?
- 已合并 Sheng Jiang 蒋晟Moderator 2015年7月27日 1:22 dup thread
-
Hi 缄言,
在.NET基础类库的webbrowser不支持这项活动。为了处理事件,你需要直接访问的ActiveX.
"WebBrowser and javascript window.close()": http://stackoverflow.com/questions/5535575/webbrowser-and-javascript-window-close
Best Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 Barry WangModerator 2015年8月10日 9:18