Skip to content

[webview_flutter] Add support for WKPreferences javaScriptCanOpenWindowsAutomatically  #112276

@lionzeye

Description

@lionzeye

Use case

In a webpage, that is running in webview_flutter, the following Javascript is executed window.open('https://google.com', '_top'). This works perfectly on Android, but iOS is ignoring it, because it requires WKPreferences bool javaScriptCanOpenWindowsAutomatically to be set to true. This is currently not possible, as this preference is not exposed via the WebView widget and not handled in the webview_flutter_wkwebview package.

Proposal

I want to add javaScriptCanOpenWindowsAutomatically as a widget parameter, which I'm able to do by reverse engineering the Dart and Objective-C code from the package. I also tested if simply setting this preference to true in FlutterWebView.m works, which does the trick. I'm just struggling to find out how exactly FlutterWebview.m is generated and how I can add the required handlers. Can someone point me in the right direction so I can provide the pull request?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterp: webviewThe WebView pluginpackageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions