Skip to content

[webview_flutter] Adds NavigationDelegate.onCreateWindow for target=_blank / window.open - #12312

Draft
mateusz-ramp wants to merge 6 commits into
flutter:mainfrom
mateusz-ramp:webview-target-blank
Draft

[webview_flutter] Adds NavigationDelegate.onCreateWindow for target=_blank / window.open#12312
mateusz-ramp wants to merge 6 commits into
flutter:mainfrom
mateusz-ramp:webview-target-blank

Conversation

@mateusz-ramp

Copy link
Copy Markdown

Adds an optional NavigationDelegate.onCreateWindow callback so hosts can
handle target=_blank / window.open (e.g. open in an external browser)
instead of only loading in the same WebView.

Behavior

  • If onCreateWindow is set: Android (WebChromeClient.onCreateWindow
    pigeon) and iOS/macOS (WKUIDelegate.createWebViewWith) invoke the callback
    with the requested URL.
  • If unset: preserves existing same-WebView load behavior.

Packages (federated review PR)

  • webview_flutter_platform_interface 2.16.0
  • webview_flutter_android 4.14.0
  • webview_flutter_wkwebview 3.27.0
  • webview_flutter 4.15.0

Path dependency_overrides are present for combined review only
(make-deps-path-based). This PR is not intended to land as-is; after
approval we will land/publish in the usual federated order (platform
interface → implementations → app-facing).

Related issues

Related to:

Background (prior same-window _blank handling):

Pre-Review Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran [the auto-formatter].
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I [linked to at least one issue that this PR fixes] in the description above.
  • I followed [the version and CHANGELOG instructions], using [semantic versioning] and the [repository CHANGELOG style], or I have commented below to indicate which documented exception this PR falls under1.
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or I have commented below to indicate which [test exemption] this PR falls under1.
  • All existing and new tests are passing.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@google-cla

google-cla Bot commented Jul 29, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant