[Webkit-unassigned] [Bug 287927] WKWebView/Sandbox Intermittent Local File Access Denial in macOS Sandbox Environment

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Feb 18 19:22:58 PST 2025


https://bugs.webkit.org/show_bug.cgi?id=287927

--- Comment #1 from sunus <sunuslee at gmail.com> ---
```
We basically load local file by this code:

WKPreferences *preferences = [[WKPreferences alloc] init];
[preferences setValue:@TRUE forKey:@"allowFileAccessFromFileURLs"];
configuration.preferences = preferences;

// Create WKWebView
self.webView = [[WKWebView alloc] initWithFrame:self.window.contentView.bounds
                                     configuration:configuration];
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
NSURL *htmlURL = [NSURL fileURLWithPath:[resourcePath stringByAppendingPathComponent:@"test.html"]];
NSURL *baseURL = [NSURL fileURLWithPath:resourcePath];

NSLog(@"Loading HTML from path: %@", htmlURL.path);
[self.webView loadFileURL:htmlURL allowingReadAccessToURL:baseURL];
```
if this approach is wrong, it wont load at all





We also post on develop forum

https://developer.apple.com/forums/thread/774395

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20250219/3cc3a28b/attachment.htm>


More information about the webkit-unassigned mailing list