Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local HTML bug #114

Closed
HaijunWei opened this issue Jul 2, 2018 · 3 comments
Closed

Local HTML bug #114

HaijunWei opened this issue Jul 2, 2018 · 3 comments

Comments

@HaijunWei
Copy link

I loaded an HTML from the sandbox and found that the css file was not loaded. I found a problem after reading the source code. In FlutterWebviewPlugin.m line 109

[self.webview loadFileURL:htmlUrl allowingReadAccessToURL:htmlUrl];

If allowingReadAccessToURL is a directory, the css file can be loaded.
Is it possible to add a directory parameter to allowingReadAccessToURL?

Reference:
https://www.jianshu.com/p/663c63db9b0f

@captainjapeng
Copy link

I'm also having this issue, assets won't load from the cache directory. Is there a way to pass the value to the allowingReadAccessToURL parameter of WKWebView?

@charafau
Copy link
Collaborator

There's not but I'm happy to add parameters if someone will tell me what and how to add it (also, PRs are more than welcomed)

@HaijunWei
Copy link
Author

You can add a parameter for launch and reloadUrl.
eg:

flutterWebViewPlugin.launch(htmlURL, readAccessToURL: xxxx)
flutterWebViewPlugin.reloadUrl(htmlURL, readAccessToURL: xxxx)

in In FlutterWebviewPlugin.m line 143 or line 193...199

NSURL *readAccessToURL = [NSURL fileURLWithPath:call.arguments[@"readAccessToURL"]];
[self.webview loadFileURL:htmlUrl allowingReadAccessToURL:readAccessToURL];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants