Ignoring request to load this main resource because it is outside the sandbox on IOS 13
See original GitHub issue**Error ** Ignoring request to load this main resource because it is outside the sandbox on IOS 13. Its only happen on IOS 13. For IOS 13 below, everything is normal
Configurartion for webview
<RNWebView ref={(ref) => (this.localWebview = ref)} originWhitelist={['*']} style={{ flex: 1 }} javaScriptEnabled domStorageEnabled allowFileAccess useWebKit startInLoadingState allowingReadAccessToURL = {'file://' + this.state.webPath} {...this.props} />
Error Message
Received an unexpected URL from the web process: 'file:///var/mobile/Containers/Data/Application/44E9B0F2-0E37-4D74-A68B-334897034D7C/Documents/localWeb/survey.html' 2019-10-15 17:38:38.504492+0700 Jakpat[2593:915422] [Process] 0x107920a18 - WebPageProxy::Ignoring request to load this main resource because it is outside the sandbox
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top GitHub Comments
In my case, the html file resides in the Documents directory with its whole path as “/var/mobile/Containers/Data/Application/89C6A690-498E-4AD1-8D0F-80834964CF2B/Documents/CopyToDocuments/OfflineWeb/meTab/index.html”. When loading the html in a WKWebView, I use the following method.
The “URL” parameter should exactly be “file:///var/mobile/Containers/Data/Application/89C6A690-498E-4AD1-8D0F-80834964CF2B/Documents/CopyToDocuments/OfflineWeb/meTab/index.html”. And there’s something interesting about the second parameter “readAccessURL”. At first, I set it as the parent folder path “file:///var/mobile/Containers/Data/Application/89C6A690-498E-4AD1-8D0F-80834964CF2B/Documents/CopyToDocuments/OfflineWeb/meTab”. This works fine on iOS 12 and prior but not on iOS 13. Then I changed it to the Documents folder path “file:///var/mobile/Containers/Data/Application/89C6A690-498E-4AD1-8D0F-80834964CF2B/Documents”, it worked fine on iOS 13 too. I don’t know the exact reason behind this trick. After diving into the source code of webkit, I found the place where the error information is logged. https://trac.webkit.org/export/252478/webkit/trunk/Source/WebKit/UIProcess/WebPageProxy.cpp I think there’s something wrong here.
I’ve got a workaround. When invoking loadFileURL: allowingReadAccessToURL: method, I passed the whole documents path instead of the parent directory as the second parameter and the problem got solved. Hope it helps.