WebHTMLViewer and local files

I am creating a little online help for my web app. Everything works, except I would like the WebHTMLViewer to view a local html file while I’m testing.
I understand that once it’s on the server I could use a real URL if I want to like www.domain.com/helpfiles/helptopic1.html but I want to test it locally on Windows using the proper syntax. I am using HelpNDoc so it creates nice html files for each topic, but has css, images etc outside of that, so I just can’t read in the html text view LoadPage.

I tried searching here and also tried a few things I saw here about using File// but could not get it to work. I’m sure it’s just me being me, but any help would be appreciated.

Folderitem has a url property that should give you what you need.

[code] dim f as folderitem
f = GetFolderItem( “file:///c:/GoHealthIOTHelp/Addcontenttoatopic.html”,FolderItem.PathTypeURL)
if f.exists then
dim file as new WebFile
file.data = “”
file.MIMEType = “text/html”
file.Filename = f.NativePath

'theDialog.HTMLViewer1.URL ="file:///" +  f.NativePath
theDialog.HTMLViewer1.URL = file.url


Am I close? I do have file setup as a property

  • File should be a property of the WebPage or of a module, and not a dim so it does not go out of scope when the event ends. If you had set it up as a property you should not dim it in the evnt which would in fact use that local variable instead of the property.
  • Why not use Wefile.Open() ?
  • Why set file.Data to “” when in fact you want the page in there ?
  • Why set the name of the file to the full native path ? No need to set it up unless you want a different one than the original.

This works :

dim f as folderitem f = GetFolderItem( "file:///c:/Users/mitch/Downloads/page.html",FolderItem.PathTypeURL) if f.exists then file = Webfile.Open(f) file.MIMEType = "text/html" HTMLViewer1.URL = file.url end

I am not quite sure using a path is the right way to go if you have several file. You may want to read up on FolderItem construction, as well as parent and child.

Perfect. Thanks