Post

Replies

Boosts

Views

Activity

Reply to WKWebview loadHTMLString not load local resources (eg. images, css, js)
I fixed problem. Before when I used UIWebView, I replaced images in the source of page to this structure: let imageFixedString =  "file://" + Bundle.main.path(forResource: imageLink, ofType: nil) bodyPage.replacingOccurrences(of: imageLink, with: imageFixedString) webView.loadHTMLString(bodyPage, baseURL: nil) But when I move to WKWebview, is stoped work. In my situation, no need replace image address, but need set baseURL: let baseUrlWk = Bundle.main.bundleURL webView.loadHTMLString(bodyPage, baseURL: baseUrlWk)
Jul ’20