0

I used System::Net::WebClient::DownloadString to get HTML code of some webpages. But, it doesn't work for some specific pages.

For this reason, I used WebBrowser2 for these pages. However, this way has some problems since it really loads pages.

I want to do these:

  1. if a page contains msgbox, I want to ignore it. (in this case, I don't want to see msg box and open other page. I don't need to get this page's HTML code.)

  2. Some pages are not a webpage but file. If I open this, it calls download control. It really iritates me. I tried to filter urls that aren't webpages, but I failed. I want to Ignore pages that are not real webpage.

What should I do?

Kara
  • 6,115
  • 16
  • 50
  • 57
Gimun Eom
  • 411
  • 5
  • 17

1 Answers1

0

The first one is generally handled by DWebBrowserEvents2::NewWindow3; you can cancel the new window. Only true for true popups, not HTML5 floating divs.

As for the downloading, that sounds like the URL identifies a resource which isn't of MIME type text/html. You'd have to get the header during DWebBrowserEvents2::BeforeNavigate2, and again you can cancel it.

MSalters
  • 173,980
  • 10
  • 155
  • 350