You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Handle target="_blank" links in authorization WebView, Fixes AB#3535641 (#3010)
**Problem**
Total loss recovery is a feature provided by VID to recover the user's
account. This gets initiated from inside of the webview. See below
screenshot for reference. Once the user clicks on "Recover your
account", the flow goes through a set of redirects - sometimes to 3P
identity verifiers where they may handle button clicks differently. They
may contain links with target="_blank" (ideally used in websites where
they want to open a new tab upon a button or link click)(e.g., Terms of
Use, privacy links), the Android WebView silently drops these
navigations. Users tap the link and nothing happens — no browser opens,
no feedback is given.
**Solution**
Override onCreateWindow to intercept target="_blank" navigations and
open them in the device's default external browser via intent.
Note : This will ONLY be enabled for TLR links. The check is made in
OnPageLoadedCallback method of WebViewAuthorizationFragment.
- **How are we gating it only for TLR URLs?** : When a page is loaded,
we know its url, we check if it matches the TLR url pattern.. If it
does, we enable multiple windows support in webview by calling the
method setSupportMultipleWindows(true). Else, it is the same as today
(set to false).
- **Would onCreateWindow method be called even when
setSupportMultipleWindows is false?** : No, it completely needs
setSupportMultipleWindows to be true. So, the code in onCreateWindow
need not be behind a flight as the code triggering it is already behind
the flight.
**Feature gating**
The change is gated behind ENABLE_WEBVIEW_MULTIPLE_WINDOWS
CommonFlight: default false (safe for MSAL/non-broker callers)
BrokerFlight: overrides to true (enabled in broker context)
**Telemetry**
The change also involves adding a new span with default sampling rate.
But we expect this span to be emitted in very low numbers (10 to 20 per
day) once Total loss recovery feature is enabled. Once this feature is
stabilized, we can remove this span.
Fixes
[AB#3535641](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3535641)
Copy file name to clipboardExpand all lines: common/src/main/java/com/microsoft/identity/common/internal/providers/oauth2/WebViewAuthorizationFragment.java
0 commit comments