Hello,
I'm exploring the new SwiftUI WebView
and WebPage
APIs introduced in iOS 26, and I have a question about configuring JavaScript window opening behavior.
In our app, we currently use WKWebView
with the javaScriptCanOpenWindowsAutomatically
property set to true to support a specific use case. This property is part of WKPreferences
and controls whether JavaScript can open windows without user interaction. According to the official documentation (WKPreferences.javaScriptCanOpenWindowsAutomatically
), this property defaults to false
on iOS and true
on macOS.
With the new iOS 26 WebView
and WebPage
APIs, I haven't been able to find a way to configure this behavior. Looking through the available configuration options, there doesn't appear to be an equivalent setting.
My questions are:
- Has the default behavior changed for the new SwiftUI WebView? Does it now allow JavaScript to open windows automatically by default on iOS?
- If not, is there a way to configure this behavior that I'm missing?
- If this configuration is intentionally not exposed, what is the recommended approach for apps that need to enable automatic window opening?
Currently, we're wrapping WKWebView
in a UIViewRepresentable
to maintain this functionality, but we'd love to migrate to the native SwiftUI WebView
later this year if possible.
Thank you for any guidance you can provide!
If you'd like us to consider adding this functionality to the SwiftUI WebView, please file an enhancement request using the Feedback Assistant. If you file the request, please post the Feedback number here so we can make sure it gets routed to the right team.
If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?