I have a problem while integrating HTML into my VFP app. I attached the simulated form: http://www.foxite.com/uploads/879e1e57-8b72-4ac8-9453-c8839f2d051e.zip
My app loads HTML into the web browser control by clicking a button. It is OK for the first click.
But on the second click, it got blank and resulted only <HTML></HTML>
.
I tried to add THISFORM.htmViewer.Refresh
. It seems to be OK, but if you click it repeatedly several times, it sometimes got blank too.
In my real app, it got blank on the second click without Refresh()
.
With Refresh()
, it got blank on the third click, and the second click is not working correctly, HTML was appended instead of overwriting the HTML loaded on the first click.
I just found a fix. The problem is the two lines below:
THISFORM.htmlviewer.navigate('about:blank')
THISFORM.htmlviewer.Document.Write(m.lcHTML)
Instead of that, I wrote the output HTML into a temp file and then load it into the browser. It worked perfectly.
lcTempFile = 'path\to\file\content_rendered.html'
STRTOFILE(m.lcHTML, lcTempFile)
THISFORM.htmlviewer.navigate(lcTempFile)
Any better fix will be appreciated.