How to display images in WKWebViewControlMBS?

How can I display images in WKWebViewControlMBS when opening an HTML page from a string (using WKWebViewControlMBS.LoadHTML)?

In the build-in HTMLViewer I can use LoadHTMLStringMBS and the following HTML code:

<img src='file:///Users/current_user/Desktop/test.jpg' width=100 height=100>

Unfortunately, It does not work in WKWebViewControlMBS. However, images are displayed when opening an actual website with WKWebViewControlMBS.LoadURL.

How to display the image?

It seems WKWebView has some additional restrictions concerning opening local files.

So, if anyone searches this forum in the future for the same problem:

It works, if I first use WKWebViewControlMBS.LoadURL method to open any local file. The file doesn’t even need to exist! Just calling WKWebViewControlMBS.LoadURL(SpecialFolder.Resources.URLPath+“test.html”) is enough to “unlock” the volume for local access from WKWebViewControlMBS. I am using a dummy html file located in my app Resources folder. After that, I can use WKWebViewControlMBS.LoadHTML(s, baseURL), where s is the string containing my html code referring to local images, and baseURL is SpecialFolder.ApplicationData.URLPath (or, in fact, a proper ApplicationData.Child() for the folder my app stores the images to be displayed). Not providing the baseURL or not using LoadURL first results in no images displayed.

It seems to work fine, and is much, much faster (seriously, orders of magnitude faster) than the built in HTMLViewer, which is based on WebView, depreciated by Apple around 10.10 and being more and more crippled with each macOS version, as far as speed is concerned.

Maybe you need to set allowFileAccessFromFileURLs property to true to make it work?
See WKWebViewControlMBS documentation.

I know why I missed that - I am using an older version of the plugins and there is no allowFileAccessFromFileURLs property here.