New to the community? Welcome! Please read our Community Rules and Guidelines
If you want to report illegal content under the EU Digital Services Act, please do so here
I have found the solution myself.
Instead of loading HTML from a string (webView.loadHTMLString) load an HTML file directly from the disk (webView.loadFileURL), as described here.