WebHTMLViewer.LoadPage
From Xojo Documentation
Loads the specified HTML into the WebHTMLViewer.
Notes
Web pages loaded using LoadPage cannot have separate origins. This primarily means that the SRC tag cannot load data (such as external JavaScript source) from outside locations. Instead, embed all the necessary content into the string before calling LoadPage.
LoadPage creates a WebFile behind the scenes. Use the URL property to load your own data without relying on system-created WebFile.
Sample Code
You can load HTML directly from a string like so:
To display HTML from a file, first load the file into a String:
If htmlFile <> Nil And htmlFile.Exists Then
Var html As String
Var htmlInput As TextInputStream
Try
htmlInput = TextInputStream.Open(htmlFile)
html = htmlInput.ReadAll
htmlInput.Close
Catch e As IOException
html = "<html><body><h1>Error loading file on server.</h1></body></html>"
End Try
HTMLViewer1.LoadPage(html)
End If
This code executes JavaScript within the HTML:
Var html As String = "<html><body>" + js + "</body></html>"
HTMLViewer1.LoadPage(html)
To display an image you have to include the proper URL path to it. If you add an image to the project and call it CompanyLogo, then you can use code like this to display it: