You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using DownView(frame: .zero, markdownString: markdown, templateBundle: bundle) and in this case bundle points to a folder in my app's documents directory. The markdown files and associated images are downloaded to this location during runtime, could be refreshed and must be kept for offline use (the template assets might be dynamic in the future too, but its not at the moment).
What did you expect to happen?
DownView renders using the template and following referenced style, JS and images.
What happened instead?
It renders the content of template file with inserted markdown content, but any content linked on index.html with local references does not load (eg. css, js, images).
Using Safari's web inspector to check on WKWebView I can see this on console: Failed to load resource: The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 1.)
Which after some research I found to be a permission issue.
I searched deeper and I think this traces down to use of loadHTMLString(_:baseURL:). baseURL points to the correct place, but in this case WKWebView doesn't have access to it by default. The alternative would be to use loadFileURL(_:allowingReadAccessTo:) which can provide read access to a path.
I wasn't sure if I should file this under feature request or a bug.
The text was updated successfully, but these errors were encountered:
Please help prevent duplicate issues before submitting a new one:
I've looked into Can not load local image and link to local .md file #40 , but it covers only local images bundled with the app.
Report
What did you do?
I'm using
DownView(frame: .zero, markdownString: markdown, templateBundle: bundle)
and in this casebundle
points to a folder in my app's documents directory. The markdown files and associated images are downloaded to this location during runtime, could be refreshed and must be kept for offline use (the template assets might be dynamic in the future too, but its not at the moment).What did you expect to happen?
DownView renders using the template and following referenced style, JS and images.
What happened instead?
It renders the content of template file with inserted markdown content, but any content linked on index.html with local references does not load (eg. css, js, images).
Using Safari's web inspector to check on WKWebView I can see this on console:
Failed to load resource: The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 1.)
Which after some research I found to be a permission issue.
I searched deeper and I think this traces down to use of
loadHTMLString(_:baseURL:)
.baseURL
points to the correct place, but in this caseWKWebView
doesn't have access to it by default. The alternative would be to useloadFileURL(_:allowingReadAccessTo:)
which can provide read access to a path.I wasn't sure if I should file this under feature request or a bug.
The text was updated successfully, but these errors were encountered: