HTMLViewer.LoadPage(Source As String… does not reload the images from disk

In a Desktop project, I compute html data from a special folder into a TextArea, then I load the string into an HTMLViewer using:


HTMLViewer.LoadPage(Source As String, …

It works fine, but I noticed a bad colored image, so I cleared if, saved it at the correct location and click to process a new html string data, then Render the string in the HTMLViewer.

I get the same old image.

I closed the HTMLViewer window, click back in Render the string and get the new one.

Monterey / Xojo 2021r2.1 (RN does not show a change in HTMLViewer)
FWIW

I get this all the time - it’s most likely just your browser caching an image it already knows that it has.

Sometimes time will allow it to free, other times you may need to clear the browser history back to a time prior to when it first downloaded the image. If you can track where the browser has the image, you can clear it but seeing as the system sometimes has them stored using UUID or UUID-like paths, that may be an issue.

If you can afford to lose it, clear your cache.

Edit: Actually you can sometimes try to trick the browser by using a suffix (e.g. name.png?xxxx) - it works in JavaScript, but don’t know whether it will work in Xojo controls as I’ve never tried it. Bit of pain to be doing this continuously though.

Maybe, but I use an HTMLViever, not a browser.

And, I do not do that so often (without quit - shutdown - reboot), until the file construction (html) is done and I save it in a .html file.

From your description, when it is my browser that is playing cards, I press the Option key (Alt in Windows I think) and click in the browser Reload button.
A brand new reload is done and no old stuff is displayed (if a new version of the document exists in the file server, it is used for display). Think “Force download the last version”…

Yeah, even if you reload the page, if the browser detects that it has the image stored in its cache it will reload that one so that it does not need to download it again (browsers always have to think of internet use, rather than local use).

The HTML viewer is really just an implementation of the local browser - it’s not a full rebuild of an HTML renderer from scratch (which would be an application in itself) - the work is being done by the default browser engine on your PC.

Try changing the folderItem. Perhaps using something like:

Var f As FolderItem = FolderItem.TemporaryFile
HTMLViewer1.LoadPage(TextArea1.Value, f)

Each time you reload, the temporary file changes, which should result in a reload.

An other way would be to save the HTMLPage to a text file (for instance in Specialfolder.Applicationdata), and point to it with LoadURL.

You can also force a reload with system calls.

Linux: webkit_web_view_reload_bypass_cache
macOS: reloadFromOrigin:
Windows: CefReloadIgnoreCache

Hi Michel,

thanks for the tip, but this is what I use (I do not recall for .Temporary).

Now, if everyone think it is not a bug, we can close the conversation.

This is just a debug feature, and closing / reopening the window with the HTMLViewer does not display the “feature”.