Closed chenyoh closed 8 months ago
try ios 16.x
try ios 16.x
I used a 16.5 iPhone 11 pro max, but the problem still occurred
Error Domain=WKErrorDomain Code=4 "A JavaScript exception occurred" UserInfo={WKJavaScriptExceptionLineNumber=2, WKJavaScriptExceptionMessage=SecurityError: The operation is insecure., WKJavaScriptExceptionColumnNumber=3614803, WKJavaScriptExceptionSourceURL=about:blank, NSLocalizedDescription=A JavaScript exception occurred}
But the same index.js will work fine on Android
Here's my code
this may caused by android security policy, you can't operate cookies or localstorage in about:blank
page. the polkawallet flutter sdk run the js file in https://github.com/polkawallet-io/sdk/blob/e3aeb2208c66500d90cf4588131ac7f2effff345/lib/service/webViewRunner.dart#L74 to avoid this issue.
this may caused by android security policy, you can't operate cookies or localstorage in
about:blank
page. the polkawallet flutter sdk run the js file into avoid this issue.
That solves my problem. Thank you
Describe the bug When I use the assets/index.js in our iOS project, I will report the following error when I use WKWebView to inject the index.js in the iOS project
Domain=WKErrorDomain Code=4 "发生JavaScript异常" UserInfo={WKJavaScriptExceptionLineNumber=2, WKJavaScriptExceptionMessage=SecurityError: The operation is insecure., WKJavaScriptExceptionColumnNumber=3621727, WKJavaScriptExceptionSourceURL=about:blank, NSLocalizedDescription=发生JavaScript异常}
This is the solution I found on the Internet but it doesn't work https://stackoverflow.com/questions/54061707/how-to-set-localstorage-item-in-webview-before-loading-a-urlrequest
Can IOS solve this problem?
Smartphone (please complete the following information):