I created a c# web browser but I wanted to block the scrips and other notification (like, while navigating to other page we get pop up windows asking "Are you sure want to leave the page")...
I handled the scrips but pop up windows still comes.
I tried with AxWebBrowser
and worked with NewWindows2
newWindow3
events nut nothing is working....
Any idea how to disable any other kind of windows on web browsers? Or if it come how to close it automatic?
Edit1: Pop up windows are coming from JavaScript.
As client site you can provide the IDocHostShowUI interface and MSHTML will call your ShowMessage method for JavaScript alerts and confirms. There you can decide whether you want to display your own UI or use the default handling. Just pretend you display something by returning S_OK
and no message box appears.
As a positive side effect you get information about all message box parameters (including type and text), so you could make a finer grade decision based on them.