Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[webview_flutter] webview not showing html on ios 12.5.1 #3613

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/webview_flutter/ios/Classes/FlutterWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,18 @@ - (bool)loadUrl:(NSString*)url withHeaders:(NSDictionary<NSString*, NSString*>*)
}
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:nsUrl];
[request setAllHTTPHeaderFields:headers];
[_webView loadRequest:request];
if([url hasPrefix:@"file"]) {
NSString * allowingReadAccessToURL = [request.URL.path stringByDeletingLastPathComponent];
if (@available(iOS 9.0, *)) {
[_webView loadFileURL:request.URL allowingReadAccessToURL:[NSURL fileURLWithPath:allowingReadAccessToURL]];
}
else {
[_webView loadRequest:request];
}
}
else {
[_webView loadRequest:request];
}
return true;
}

Expand Down