DesktopHTMLViewer.LoadPage

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

HTMLViewer.LoadPage(Source As String, RelativeTo As FolderItem)

New in 2021r3

Supported for all project types and targets.

Loads source (a String containing HTML) into the HTMLViewer. RelativeTo is any file or folder and is only used as a reference for resolving links and temporary files.

Notes

Any links will be resolved relative to the passed RelativeTo FolderItem.

fa-exclamation-circle-32.png
This method signature is not supported on Windows due to CEF Security.

Sample Code

In this example, the raw HTML is in a TextArea:

Var f As FolderItem = FolderItem.TemporaryFile
HTMLViewer1.LoadPage(TextArea1.Value, f)


Method

DesktopHTMLViewer.LoadPage(File as FolderItem)

Supported for all project types and targets.

Loads the the supplied File into the HTMLViewer. File must be an actual file and not a folder.

Sample Code

This example loads an HTML file from disk. The file type has been added using the File Types Set Editor:

Var f As FolderItem

f = FolderItem.ShowOpenFileDialog("text/html")
If f <> Nil Then
HTMLViewer1.LoadPage(f)
End If