定制的IE浏览器,遇到页面中有showDialogModal时会用系统默认浏览器打开。

时间:2022-11-01 13:39:37
我使用的是webbrowser,
当页面中的showDialogModal()被调用时,会被默认浏览器打开。(IE)
我不想用IE打开,也不想修改那个网页。就想全程都用自己这个浏览器打开。

请朋友们帮忙,指导一下。

4 个解决方案

#1



execScript(
@"window.showModalDialog= function (){
   //javscript code to open your webbrowser.
   //js代码可以回调c++或c#代码的,这是另外的问题了,请自行查。
}");


#2


INewWindowManager接口和IDocHostShowUI接口尝试下

#3


两种方法:
1) 把系统默认浏览器改成你的程序 哈哈

2)
处理 DWebBrowserEvents2::NewWindow3 事件,在其中把 ppDisp 赋值为你的程序中的浏览器的IDispatch

#4


NewWindow3事件不可以捕获 showModalDialg


Note   The DWebBrowserEvents2::NewWindow3 event is only fired when a new instance of Internet Explorer is about to be created. Calling IHTMLWindow2::showModalDialog or IHTMLWindow3::showModelessDialog does not trigger an event because they are not new instances of Internet Explorer. They are implemented as MSHTML host windows, which allows them to render and display HTML content but not hyperlinks between documents.

#1



execScript(
@"window.showModalDialog= function (){
   //javscript code to open your webbrowser.
   //js代码可以回调c++或c#代码的,这是另外的问题了,请自行查。
}");


#2


INewWindowManager接口和IDocHostShowUI接口尝试下

#3


两种方法:
1) 把系统默认浏览器改成你的程序 哈哈

2)
处理 DWebBrowserEvents2::NewWindow3 事件,在其中把 ppDisp 赋值为你的程序中的浏览器的IDispatch

#4


NewWindow3事件不可以捕获 showModalDialg


Note   The DWebBrowserEvents2::NewWindow3 event is only fired when a new instance of Internet Explorer is about to be created. Calling IHTMLWindow2::showModalDialog or IHTMLWindow3::showModelessDialog does not trigger an event because they are not new instances of Internet Explorer. They are implemented as MSHTML host windows, which allows them to render and display HTML content but not hyperlinks between documents.