WebBrowser control displaying security alert dialogs
-
Hello, I'm using the webbrowser control in an application where the crawling is totally automated. The problem is that sometimes the browser try to crawl an archive file or whatever. In that case a security alert dialog box pops up and my webbrowser control waits for this dialog to close. I already succeded removing all Javascript dialogs by implementing the IDocHostShowUI interface and by putting the control into the "silent" mode (put_silent()). I also implemented the IDocHostUIHandler to return S_OK or S_FALSE wherever possible to get rid of a maximum of MSHTML UI unwanted behaviours. But I still get this security alert dialogs and I have no ideas of how to avoid them. The only solution I found for the moment is to filter the links the webbrowser control can crawl in a page by removing files containing 'zip','rar','mp3','jpg','gif'... And so on. But this solution is not perfect because of the number of possible file types and because sometimes you can't even guess what it is from the URL. If only the webbrowser control could allow me to access the HTTP file headers before display, to guess what it is from the content-type ! But even if I can filter the URL I crawl, I would really like a solution to remove the security alert dialogs. I also tried to tweak the Internet Explorer options to avoid prompts and dialogs but I didn't solve this problem. Any idea ? Thanks, R. LOPES Just programmer.
-
Hello, I'm using the webbrowser control in an application where the crawling is totally automated. The problem is that sometimes the browser try to crawl an archive file or whatever. In that case a security alert dialog box pops up and my webbrowser control waits for this dialog to close. I already succeded removing all Javascript dialogs by implementing the IDocHostShowUI interface and by putting the control into the "silent" mode (put_silent()). I also implemented the IDocHostUIHandler to return S_OK or S_FALSE wherever possible to get rid of a maximum of MSHTML UI unwanted behaviours. But I still get this security alert dialogs and I have no ideas of how to avoid them. The only solution I found for the moment is to filter the links the webbrowser control can crawl in a page by removing files containing 'zip','rar','mp3','jpg','gif'... And so on. But this solution is not perfect because of the number of possible file types and because sometimes you can't even guess what it is from the URL. If only the webbrowser control could allow me to access the HTTP file headers before display, to guess what it is from the content-type ! But even if I can filter the URL I crawl, I would really like a solution to remove the security alert dialogs. I also tried to tweak the Internet Explorer options to avoid prompts and dialogs but I didn't solve this problem. Any idea ? Thanks, R. LOPES Just programmer.
GriffonRL wrote: But even if I can filter the URL I crawl, I would really like a solution to remove the security alert dialogs. I also tried to tweak the Internet Explorer options to avoid prompts and dialogs but I didn't solve this problem. If you have an automatic crawler, why should you have anything displayed while you are crawling ? If you have anything displayed, Internet Explorer runs in "interactive" mode, and I believe ActiveX security boxes are hardwired in this mode. It is possible to use Internet Explorer like a COM dll : see a MSDN sample called "WalkAll".
-
GriffonRL wrote: But even if I can filter the URL I crawl, I would really like a solution to remove the security alert dialogs. I also tried to tweak the Internet Explorer options to avoid prompts and dialogs but I didn't solve this problem. If you have an automatic crawler, why should you have anything displayed while you are crawling ? If you have anything displayed, Internet Explorer runs in "interactive" mode, and I believe ActiveX security boxes are hardwired in this mode. It is possible to use Internet Explorer like a COM dll : see a MSDN sample called "WalkAll".
Hello Stephane, If I am right WalkAll use MSHTML only not the WebBrowser control. The problem if that I lack a lot of features if I use MSHTML instead of the WebBrowser control. I would need to implement all the navigation stuff and more. Moreover, even if this is an antomatic crawler, I sometimes switch to some manual control. Nevertheless thanks for the answer. Any other idea ? Regards, R. LOPES Just programmer.
-
Hello Stephane, If I am right WalkAll use MSHTML only not the WebBrowser control. The problem if that I lack a lot of features if I use MSHTML instead of the WebBrowser control. I would need to implement all the navigation stuff and more. Moreover, even if this is an antomatic crawler, I sometimes switch to some manual control. Nevertheless thanks for the answer. Any other idea ? Regards, R. LOPES Just programmer.
GriffonRL wrote: If I am right WalkAll use MSHTML only not the WebBrowser control Yes, I would use monikers to get the content pointed by the URL, retrieve the data then throw it at an actual web browser instance (where I would simply do a IPersistFile->Load(...) or something like that). The fact that you see the data makes you have the opportunity to strip off all messing tags, if required. (you need an html parser). GriffonRL wrote: Any other idea ? Become a hacker :wtf:. You have to find the way to make the Internet Explorer temporarily switch to low-security mode, where ActiveX and stuff are all ok.