Missing images in HTMLViewer: String HTML refers to FILE://<local image.png>

i’m using an HTMLViewer to show tutorial texts. The HTML is stored in a database, sent to the HTMLViewer as text. Within the HTML are references to a handful of images in the form: src=“file://Macintosh%20HD/Users/Shared/< … folder names…>/image001.jpg”>

Instead of an image in the HTMLViewer, I see a grey border outlining where the image should go. The code works fine when run on Windows. The paths are correct; if I change them to a wrong path I get a broken image path icon.

This seemed to work with a late 2015 XOJO release.

Opening an HTML file structured this way in Chrome on a Mac works. On Safari I get the outlines.

Suggestions on how to make my architecture work without putting all my HTML texts in an adjacent folder?

-Tom

Do you actually save the required images to those locations ?
If not then you should

And personally I WOULD NOT use absolute file references in the HTML

  1. The users HD may not be called “Macintosh HD”…
  2. the images must be in a location that cannot be changed

use relative paths… “./images/image001.png” for example

Save the pictures out to the ApplicationSupport folder and write the URLPath in to the HTML source before displaying… You could also encode the images and embed them right in to the HTML so you don’t have to worry about file paths…

i would put the path of those images excluding the image name and jpg/png into a placeholder and then when reading the html from data file, replace the placeholder with the real folder name

I can tell you what the LR does (it has the HTML and images all in a database)
When a page is requested we

  1. write the page html to a temporary location - the page has URLs as relative to the page
  2. write out all the images next to that page
  3. load the HTML, not from a string, but from that html file and there’s the images