New Windows HTMLKit/Viewer: Where to store temp files for viewing?

Before 2017r1 we would store temporary HTML files and images in the SpecialFolder.ApplicationData location, and then when using HTMLViewer.LoadPage we’d supply that as the RelativeTo folderitem. This works fine on Mac and has worked fine on Windows until the recent update. Now the images stored in that location simply won’t load.

What location should I be using for this situation with the new HTMLKit on Windows?

Thanks

Mmm have you tried SpecialFolder.Temporary.Child(filename)? I am using it without problems on both Mac and Win.

(Screenshot HTMLviewer in action I am using it as kind of report generator)

[quote=327145:@Tom Iwaniec]Before 2017r1 we would store temporary HTML files and images in the SpecialFolder.ApplicationData location, and then when using HTMLViewer.LoadPage we’d supply that as the RelativeTo folderitem. This works fine on Mac and has worked fine on Windows until the recent update. Now the images stored in that location simply won’t load.

What location should I be using for this situation with the new HTMLKit on Windows?

Thanks[/quote]

Does the local built in language reference show images ?
We just use SpecialFolder.Temporary and all the image urls are relative to the page (which happens to be there too)

I’ve switched to SpecialFolder.Temporary and it works fine on Mac but still not working on Windows 7 or 10. The page loads fine, but the images will not load at all.

I don’t have Xojo installed in any of the Windows machines (they just use remote debugger for testing). I’ll try to download it on one of those machines now.

  • I’m using HTMLViewer.LoadPage ( Source As String, RelativeTo As FolderItem ), supplying the source as a string and the RelativeTo folder item is a blank HTML page stored at User/AppData/Local/Temp/(App Name)/HTML/theHtmlFile.html
  • The images are stored in that location (within the HTML directory) on demand as PNG/JPG images before the page is loaded
  • The HTML source references the png/jpg files as being in the same folder such as <img src="thisImage.png">
  • If I save the exact HTML code to a file in that directory and then launch it in Firefox it will load the images without issue

htmlviewer type set to native is it ?
or webkit ?
try webkit and see if behaviour changes

It’s already set to webkit (I needed to use that for various reasons).

Just installed 2017r1 on the Windows 7 machine and it looks like the images in the local built in language reference aren’t loading either, but that actually seems to be happening on Mac too (for example, the warning icon for OLEObject.EventTriggered doesn’t load).

Built in language ref On PC

On Mac

For some reason the images in my app are loading fine in this situation on Mac though.

ah that image is specified in the CSS and is a “known issue” with the LR

alrighty I am using native Internet Explorer Engine on Windows… this is where I am saving the PathtoFile

Are there any images that I could check on the Windows side? Not really sure what to do here but I can’t get any images to load (from CSS or directly referenced in the HTML) for anything on Windows.

if you want to include pictures you have to use absolute paths or URLs file:c:/path/file or https://domain/filename a better option is to include your graphics into HTML document as base64 binary code … gimme a second…

The whole point of using HTMLViewer.LoadPage ( Source As String, RelativeTo As FolderItem ) is so that you wouldn’t have to use absolute paths, that could lead to a large number of issues. I’m also not writing the actual HTML to disk, I’m loading it as the source string.

I am saving my Pics straight into same SpecialFolder.Temporary. From there you can reference them in your HTML file.

this is the error. you must write it down as file, give it a try.
check my snippet above in the screenshot

You don’t necessarily have to write it down to a file, but the images need to be relative to the FolderItem you pass as RelativeTo. I was confused the first time around, you must pass this RelativeTo FolderItem as if it was the HTML file, not the enclosing dir with the images. Perhaps that’s the issue?

Looks like it’s a bug and you have to actually write the HTML to the file.

The images were correctly stored in the proper relativeTo location (since they always worked with previous versions). Writing the HTML to the dummy file and loading that (instead of loading the HTML string and using the HTML file as the RelativeTo file) seems to work on Mac and PC.

Not sure if this is really a bug. How should the in-memory html doc “know” where his doc-base is? Maybe this works if the proper meta tags are set…

It knows because supply the second parameter of the function as a folder item:

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

The RelativeTo FolderItem.
I had this working at one point…

I’m having a secondary problem now where writing the page to disk and then attempting to load it won’t work (the page is around 26kb). I think the writing isn’t finishing before the load starts even though they’re in the same method and I’m not using any threads associated with this.