it seems LoadUrl wants to have http or https prefix to the url.
don’t know if it accepts file:// ?
I would use the LoadPage method, if the file is on the computer ?
Apologies. It was a space on the end of the file name that did me in. I split the text file that I had built but it didn’t remove an extra carriage return. It doesn’t even show as an extra space on an editor.
I couldn’t figure out why I couldn’t create a folderitem for the longest.
We had a similar case a few weeks ago, those are nasty bugs. What might help you in future is looking at the variable in the binary view to find such extra characters.
Obviously, anchors do not seem to work in Mac HTMLViewer.
Here is a workaround, which displays the content from the anchor (here, “#example”):
Dim f As folderitem = SpecialFolder.UserHome.child("Downloads").child("anchor.html")
Dim PageContent As String
If f.exists Then
If f <> Nil Then
If f.Exists Then
// Be aware that TextInputStream.Open could raise an exception
Var t As TextInputStream
Try
t = TextInputStream.Open(f)
t.Encoding = Encodings.UTF8
PageContent = t.ReadAll
Catch e As IOException
MessageBox("Error accessing file.")
End Try
t.Close
End If
End If
Dim PageCuts() As String = PageContent.Split("<a href=""#example"">")
HTMLViewer1.LoadPage("<html><body>" + PageCuts(1), FolderItem.TemporaryFile)
Else
MsgBox "merde"
End If