MobileHTMLViewer.LoadPage
From Xojo Documentation
Method
MobileHTMLViewer.LoadPage(file As FolderItem)
New in 2020r2
Supported for all project types and targets.
New in 2020r2
Supported for all project types and targets.
Displays the HTML file passed.
Method
Displays the HTML passed.
Notes
Loading HTML From Documents Folder
iOS sandboxing of the app and the HTML Viewer can prevent the HTML Viewer from seeing files that are in the app's Documents folder. This code can be used to provide access to files in the Documents folder:
Declare Function NSClassFromString Lib "Foundation.framework" (clsName As CFStringRef) As ptr
Declare Function URLWithString Lib "Foundation.framework" Selector "URLWithString:" ( id As Ptr, URLString As CFStringRef ) As Ptr
Declare Sub loadFileURL Lib "UIKit.framework" Selector "loadFileURL:allowingReadAccessToURL:" (obj As Ptr, url As Ptr, readAccessURL As Ptr)
// htmlFile is a FolderItem from SpecialFolder.Documents
Var nsURL As Ptr = URLWithString(NSClassFromString("NSURL"), htmlFile.URLPath)
Var readURL As Ptr = URLWithString(NSClassFromString("NSURL"), htmlFile.parent.URLPath)
loadFileURL(HTMLViewer1.Handle, nsURL, readURL) // Display the contents in an MobileHTMLViewer
Declare Function URLWithString Lib "Foundation.framework" Selector "URLWithString:" ( id As Ptr, URLString As CFStringRef ) As Ptr
Declare Sub loadFileURL Lib "UIKit.framework" Selector "loadFileURL:allowingReadAccessToURL:" (obj As Ptr, url As Ptr, readAccessURL As Ptr)
// htmlFile is a FolderItem from SpecialFolder.Documents
Var nsURL As Ptr = URLWithString(NSClassFromString("NSURL"), htmlFile.URLPath)
Var readURL As Ptr = URLWithString(NSClassFromString("NSURL"), htmlFile.parent.URLPath)
loadFileURL(HTMLViewer1.Handle, nsURL, readURL) // Display the contents in an MobileHTMLViewer
See Also
LoadURL method.