Re: WKWebView does not load images


 



On Oct 6, 2017, at 7:58 AM, Gerriet M. Denkmann <g@...> wrote:

htmlString contains: …<img alt=“alternate”  src=“/path/to/myImage.gif” /> ….

WKWebView just shows a rectangle containing: “alternate”.

WKWebView has more security, so it probably disallows filesystem access. Or at least you may need to configure something about the “origin” or “security domain” to enable it. Or setting the baseURL to a “file:” URL might help.

Basically, it’s a security hole to let HTML loaded from the web access the local filesystem. WebView assumes HTML you give it from a string is local/trusted, but it looks like WKWebView doesn’t.

—Jens

Join cocoa@apple-dev.groups.io to automatically receive all group messages.