Repository navigation
feat(webview): route page window requests to the app - #1663
Merged
Merged
Conversation
houko
force-pushed
the
feat/webview-window-requests-113
branch
from
November 21, 2026 13:50
5b898eb to
3e5cc20
Compare
houko
force-pushed
the
feat/webview-window-requests-113
branch
2 times, most recently
from
November 21, 2026 14:15
4baf6f6 to
d8bc0a9
Compare
houko
force-pushed
the
feat/webview-window-requests-113
branch
from
November 21, 2026 17:18
d8bc0a9 to
d88c2b8
Compare
houko
force-pushed
the
feat/webview-window-requests-113
branch
from
November 21, 2026 17:57
d88c2b8 to
51ab240
Compare
houko
force-pushed
the
feat/webview-window-requests-113
branch
from
November 21, 2026 19:02
51ab240 to
605f6b4
Compare
This was referenced Nov 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
core.WebView.OnOpenWindowreports a page's requested URL and the platform's user-gesture classification. The app can load the URL, open it elsewhere, or ignore it. Apple, Linux, and Windows suppress their native popup in every case. A restricted view checks the request against its navigation policy and reports refused URLs throughOnError.WebKit's public navigation action exposes navigation type. On macOS this change enables WebKit's public popup blocker, so a script's delivered request comes from a WebKit user gesture. Apple's link and form classifications use
WKNavigationType. WebKitGTK and WebView2 supply a gesture flag.The gallery's inline WebView shows the URL requested by its new-window link. Its Change page state button updates the fragment and title through JavaScript. The demo shows the latest URL and title from OnNavigationStateChange.
Refs #113. This PR covers new-window handling. The same-document navigation changes are in #1654, #1657 and #1661.
Targets
core)Screenshots
None.
Verification
go tool nsgo test -target macos ./internal/testhost/testdata/websource(5 passed).go tool nsgo test -target linux -run '^TestWebWindow' ./internal/testhost/testdata/websourceunder Xvfb with WebKitGTK (2 passed).window.openfrom a click and from a timer, a form target, access denial, and suppression without a callback.go tool nsgo test -run '^TestWeb|^TestSendInput' ./coreandTestPublicAPINamesNoInternalType.go tool nsgo test -run '^TestMedia$|^TestCookieStore$' ./examples/gallery. The gallery test checks the history and title script and renders the reported URL and title.go tool nsgo check ./examples/gallerypassed.go tool nsgo check.go tool nsgo check -target macos,ios,linux,windows -jobs 2 ./internal/platform.go tool nsgo test -run '^TestWebView2WindowRequests$' ./internal/platform/windowson an interactive Windows runner. Both subtests passed. WebView2 receives trusted browser clicks through DevTools without moving the desktop cursor. The test now runs in Windows CI.Checklist