Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Commit

Permalink
[[ Bug 22816 ]] Fix permissions when loading a local html file
Browse files Browse the repository at this point in the history
This patch uses the `loadFileURL:allowingReadAccessToURL:` instance
method of the WKWebView class to load a local html file. This fixes
an issue with insufficient permissions on iOS 12 devices that prevented
the html file from being loaded.
  • Loading branch information
livecodepanos committed Jul 23, 2020
1 parent 208cdd1 commit 86b3a36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/notes/bugfix-22816.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Fix permissions when loading a local html file on iOS 12
5 changes: 4 additions & 1 deletion libbrowser/src/libbrowser_wkwebview.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,10 @@ - (void) loadRequest:(MCWKWebViewLoadRequest *)request inWebView:(WKWebView *)we
MCBrowserRunBlockOnMainFiber(^{
if (request.htmlText == nil)
{
[webView loadRequest:[NSURLRequest requestWithURL:request.url]];
if (request.url.host)
[webView loadRequest:[NSURLRequest requestWithURL:request.url]];
else
[webView loadFileURL:request.url allowingReadAccessToURL:request.url];
}
else
{
Expand Down

0 comments on commit 86b3a36

Please sign in to comment.