Feat(browser): Add WhatsApp in-app browser detection for iOS & Android - #841
Merged
Merged
Conversation
Detect the WA4A/<version> (Android) and WAiOS/<version> (iOS) tokens appended by the WhatsApp in-app browser, reported as an `inapp` type.
Revert the build output (dist bundles, .mjs and .d.ts) so the branch contains only hand-edited sources. These files are produced by `npm run build` at release time.
Contributor
Author
It is now updated, please review |
faisalman
approved these changes
Aug 22, 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.
Prerequisites
Type of Change
Feature: new browser detection rule.
Description
Links opened inside WhatsApp are rendered by its in-app browser, which appends a vendor token to the user-agent string:
WA4A/<version>on Android and[WAiOS/<version>]on iOS.Current behavior: The token is ignored, so the in-app browser is misreported as the underlying engine browser:
Android Browser 4.0(from the webview'sVersion/4.0token)Mobile Safari 26.6New behavior: Reported as WhatsApp with
type: "inapp", consistent with the other in-app browsers already supported:WhatsApp 2.26.30.97,type: inappWhatsApp 2.26.31,type: inappChanges
src/main/ua-parser.js: one rule added to the WebView section:\bprevents matching mid-token, and the separator class[\/ ]keeps it anchored to the version delimiter.src/enums/ua-parser-enums.js: addedWHATSAPP: 'WhatsApp'toBrowserName, per the contributing guide.test/data/ua/browser/browser-all.json: added the two user-agent samples below..mjs/.d.tsanddist/bundles vianpm run build.Note on prior art
This is unrelated to the WhatsApp link-preview fetcher (
WhatsApp/2.23.20.0) requested in #412, which is already detected throughua-parser-extensions. That one is a crawler, but this is the user-facing in-app browser. Both can now be identified independently.Test
Two real cases added to
test/data/ua/browser/browser-all.json:Ran
npm run build+test, all passingImpact
No breaking changes, but it is a behavior change for these user agents, the code that currently sees
ChromeorMobile Safarifor WhatsApp webview traffic will now seeWhatsApp. Consumers keying on browser name for those sessions may want to checktype === 'inapp'. This matches how the library already treats every other in-app browser.No new dependencies. The rule is appended after the existing Bing entry and does not alter the ordering or matching of any other pattern.