Loading HTML into a WEB Browser Control from Variable
NOTE
The Web Browser control works much better when loading HTML from a file.
This is sample code. Add error handling and adjust to your requirements as necessary. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 lcHtml = [<html><body>Hello World!</body></html>] lnLoadTimeout = 3 && seconds WITH Thisform.oWeb.OBJECT .Navigate("about:blank") * Wait for load completion lnStartSeconds = SECONDS() DO WHILE .ReadyState <> 4 ; AND (SECONDS()-lnStartSeconds <= lnLoadTimeout ) DOEVENTS ENDDO * Load HTML into Web Browser Control .Document.Open() .Document.Write(lcHtml) .Document.Close() * Wait for load completion lnStartSeconds = SECONDS() DO WHILE .ReadyState <> 4 ; AND (SECONDS()-lnStartSeconds <= lnLoadTimeout ) DOEVENTS ENDDO ENDWITH
Comments
Web Browser Code Sample
Thanks !
This was extremely helpful. I just found myself in a situation when the WebBrowser could not finish loading a simple HTML file. (On the background I have another ActiveX component running that was probably bringing the issue). Using this aproach everything runs perfectly.
<b>Thanks again!</b>
Just for the records, in case this may help someone else.
My final solution was to use SYS(2333,1), to acrtvate the ActiveX dual interface support.
Regards
Cesar
Switching pages...
Thanks, Josh.
Re: Switching pages...
Can you load HTML and than "about:blank" in IE w/o problem?
BTW, you can load HTML from a file directly
Switching pages...
Re: Switching pages...
I'm finding that if I *do
I guess you also remove code
.Document.Open()
I have problem with this Active X, send a Ole error code
and then when I run the example in this line: .Document.Open()
occurr other error. I think that the second error is a consequence of the first error.
You have any idea about that ....
Mario
problem with sample code?
Re: problem with sample code?