0

We display some web pages in our MFC application. We use an ordinary IWebBrowser2 object, and we just do a Navigate2() call to display a certain URL.

But often, the page is not displayed. We just get a blank (white) control in our dialog. If we right click and choose "Refresh", the page is displayed correctly. This doesn't happend all the time - sometimes the page is displayed as it should without Refresh.

And everything seems to be OK on the server. This is the log:

--- we do a Navigate2()

172.16.0.119 - - [24/Apr/2017:15:05:10 +0200] "GET /home/Rapport/a57cafd8-28ee-11e7-97b5-43f9990267b7.xml HTTP/1.1" 200 31095 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.9200"
172.16.0.119 - - [24/Apr/2017:15:05:10 +0200] "GET /xslt/KVE865001.xslt HTTP/1.1" 200 10742 "http://172.29.8.80/xslt/KVE865001.xslt" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.9200"

--- we do a Refresh

172.16.0.119 - - [24/Apr/2017:15:05:40 +0200] "GET /home/Rapport/a57cafd8-28ee-11e7-97b5-43f9990267b7.xml HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.9200"
172.16.0.119 - - [24/Apr/2017:15:05:40 +0200] "GET /xslt/KVE865001.xslt HTTP/1.1" 304 - "http://172.29.8.80/xslt/KVE865001.xslt" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.9200"
172.16.0.119 - - [24/Apr/2017:15:05:40 +0200] "GET /css/styles01.css HTTP/1.1" 200 905 "http://172.29.8.80/home/Rapport/a57cafd8-28ee-11e7-97b5-43f9990267b7.xml" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.9200"
172.16.0.119 - - [24/Apr/2017:15:05:40 +0200] "GET /images/topleft01.gif HTTP/1.1" 200 207 "http://172.29.8.80/home/Rapport/a57cafd8-28ee-11e7-97b5-43f9990267b7.xml" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.9200"
172.16.0.119 - - [24/Apr/2017:15:05:40 +0200] "GET /images/topright01.gif HTTP/1.1" 200 211 "http://172.29.8.80/home/Rapport/a57cafd8-28ee-11e7-97b5-43f9990267b7.xml" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.9200"
172.16.0.119 - - [24/Apr/2017:15:05:40 +0200] "GET /images/bottomleft01.gif HTTP/1.1" 200 209 "http://172.29.8.80/home/Rapport/a57cafd8-28ee-11e7-97b5-43f9990267b7.xml" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.9200"
172.16.0.119 - - [24/Apr/2017:15:05:40 +0200] "GET /images/bottomright01.gif HTTP/1.1" 200 208 "http://172.29.8.80/home/Rapport/a57cafd8-28ee-11e7-97b5-43f9990267b7.xml" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.9200"

First, only the XML and the XSLT files are fetched from the server - and the control is blank. When we Refresh, those files are fetched again. They don't need to be sent, though (status 304), so they were fetched correctly the first time. But the second time, the web browser control moves on, and also gets the CSS file and a couple of GIF:s. And the page is displayed.

Does anybody knows what could cause this "half hearted" loading of the web page the first time? Is there some "IWebBrowser2 quirk" we should know about, or something we could do differently in our application? We haven't been able to solve this - I would be VERY grateful for some help!

/Anders from Sweden

UglySwede
  • 429
  • 1
  • 7
  • 16
  • [IWebBrowser2::Navigate2](https://msdn.microsoft.com/en-us/library/aa752134.aspx) has a return value. What value(s) does it return for you? – IInspectable May 24 '17 at 10:41
  • We get an S_OK. Navigate2() works asynchronously - the call to Navigate2() returns right away, but the loading of the webpage (via Internet Explorer) continues in the background. The IWebBrowser2 control is a "black box" to us, which makes it difficult to debug... :-( – UglySwede Jun 05 '17 at 10:32
  • 1
    The `IWebBrowser2` interface can be wired up to an event sink ([DWebBrowserEvets](https://msdn.microsoft.com/en-us/library/aa768309.aspx)), making it a bit less black-box-y. – IInspectable Jun 05 '17 at 10:56

0 Answers0