iOS 15 WKWebview evaluateJavaScript API does not work for accessing "window.subObj"

We call webView evaluateJavaScript:javaScript completionHandler:^(id _Nullable result, NSError *_Nullable error) API to inject a javascript to WKWebView.

The javascript contains "window.***"definition.

Since iOS 15, "window.***" can not be found and it will return "undefined" when accessing "window.***" . It seems that javascript "window" object can not have any custom sub-object.

However same javascript code works fine on iOS 14.x and below.

Any ideas? Thanks!

We have the same issue. We migrate all our scripts on WKUserScript and it’s working fine.

webView evaluateJavaScript:javaScript completionHandler:^(id _Nullable result, NSError *_Nullable error) worked fine in the last iOS Beta 15

Thanks for the information, I'm now upgrading my device to iOS 15 beta 8.

we get it as a bug in beta version, and try to avoid it, however, the release version 15.1 fixed it,crying&Tearful

iOS 15 WKWebview evaluateJavaScript API does not work for accessing "window.subObj"
 
 
Q