iOS15 ,WkWebview,evaluateJavaScript

Execute java script in ios15 system, h5 developers cannot get the value on the window. System below ios15 is normal

Accepted Reply

What will happen to existing apps who use evaluateJavascript (with custom property added to window object) and upgrade to iOS 15? Won't they stop working?

  • -(void)webView:(WKWebView*)webView didFinishNavigation:(WKNavigation*)navigation

    After webVIew is loaded and then use evaluateJavascript to load custom properties can also be successful

Add a Comment

Replies

I have meet the same error. Maybe the WKWebview function "evaluateJavaScript:" occurs some problems. Try another way to inject your code to solve this problem. For example

     WKUserScript *script = [[WKUserScript alloc] initWithSource:@"window.exeData = '1'" injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:NO];
    [webView.configuration.userContentController addUserScript:script];

Hope this way can help you.

  • I have meet the same error and the injection of my code resolved this problem. Thanks

  • Thank you for your reply

Add a Comment

What will happen to existing apps who use evaluateJavascript (with custom property added to window object) and upgrade to iOS 15? Won't they stop working?

  • -(void)webView:(WKWebView*)webView didFinishNavigation:(WKNavigation*)navigation

    After webVIew is loaded and then use evaluateJavascript to load custom properties can also be successful

Add a Comment

-(void)webView:(WKWebView*)webView didFinishNavigation:(WKNavigation*)navigation

After webVIew is loaded and then use evaluateJavascript to load custom properties can also be successful