Guides
How to Detect an Android WebView App From Your Website: the wv Token and Its Limits
To tell whether your site is open inside an Android app, look for the wv token in the user agent. Here is what Google documents, when the check fails and a five-minute phone test.
To detect an Android WebView from your website, check the user agent for the token wv. Google's Android Developers Blog says sites can keep looking for wv, unless the app has decided to override the user agent string. That makes the check useful for small things, like hiding an install banner inside an app, but unreliable as a gate. Here is what Google documents, where the check breaks and how to confirm it on a real phone.
How do I detect an Android WebView from my website?
Your server receives a User-Agent header with every request, and your page can read the same value from navigator.userAgent. In a default Android WebView, that string contains the token wv inside the parentheses, for example `; wv)`. A normal Chrome browser tab on Android does not include it. So the simplest check is whether the string contains `wv`, and in JavaScript that looks like `navigator.userAgent.includes('; wv)')`.
Treat the result as a hint, not a fact. A WebView app can replace its user agent, and the next section explains what Google says happens then.
What does the Android WebView user agent look like?
Google's post on user-agent reduction on Android WebView, published December 2024, says that beginning in Android 17 the default WebView user agent is reduced, as Chrome's already is. Google's example of the reduced string is: `Mozilla/5.0 (Linux; Android 10; K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/<major>.0.0.0 Mobile Safari/537.36`. The Chrome version is a placeholder here, because it changes with each WebView release.
| Part | What Google says |
|---|---|
| Linux; Android 10; K | Operating system, CPU and build details are reduced to this fixed text, so it no longer shows the real Android version or device model. |
| wv | The token sites can keep using to recognise a WebView, unless the app overrides the string. |
| Chrome/<major>.0.0.0 | Minor, build and patch version numbers are reduced to 0.0.0. |
| Version/4.0, AppleWebKit/537.36 (KHTML, like Gecko), Mobile Safari/537.36 | The rest of the default string remains unchanged. |
One practical consequence: if your server used the Android version or phone model from the user agent, that detail will read the same on every Android 17 WebView. That is a reason to avoid depending on it. Our Android 17 behavior changes guide covers other changes to test.
When does the wv check fail?
It fails whenever the app sets its own user agent. Google says the ability to set a custom string with setUserAgentString() is not affected, and apps that do so will not send the reduced string. Google also describes a common pattern: an app reads the default string and appends its own suffix. In that case, the default part is still reduced and the suffix is left as written.
- If the app replaces the whole string, the wv token may be gone and your check returns false.
- If the app appends a suffix, wv should still be present, and you can also look for the suffix if your app builder tells you what it is.
- If a person opens your site in a normal browser tab, there is no wv, and your check correctly returns false.
Google's post also notes that WebView has supported User-Agent Client Hints since version 116, but only for apps that send the default user agent string. So client hints cannot be assumed either.
What should you use instead of user agent sniffing?
MDN's guide to browser detection using the user agent says parsing the string is very hard to do reliably and is often a cause of bugs. Its advice is to check for the feature you actually need, such as `'geolocation' in navigator`, and to use CSS feature queries or media queries for layout. For touch devices it suggests checking `navigator.maxTouchPoints` rather than guessing from the string.
| You want to... | Better approach |
|---|---|
| Hide a Download our app banner inside the app | wv check is reasonable here. If it misses, the worst result is a banner that stays visible. |
| Fix a layout problem on small screens | Use CSS media queries or flexible layouts, not the user agent. |
| Show a button only if the browser supports a feature | Feature detection, for example checking the property exists on navigator. |
| Switch away from Google sign-in inside the app | wv check is a common trigger. See Error 403 disallowed_useragent for what works instead. |
| Apply CSS changes that only run in the app | Ask your app builder whether it supports app-only CSS, and see optimizing your website for a WebView app. |
How do I check the real user agent on a phone?
- 1
Add a test page
Create a plain page on your site that prints navigator.userAgent in large text, and keep it unlinked.
- 2
Open it in Chrome
Open the page in Chrome on an Android phone and note the string. It should not contain wv.
- 3
Open it in your app
Load the same page inside your app build. Look for wv, and for any extra suffix at the end.
- 4
Repeat on Android 17
If you have an Android 17 device, compare the strings. Google says the OS and model details are reduced to fixed text.
- 5
Record the result
Write down what you saw for each build, and re-run the test after every rebuild, because the app can change its user agent.
What should you remember?
- 1Look for the wv token, and treat it as a hint.
- 2Do not rely on the Android version or device model in the string on Android 17 and later, since Google says they are reduced.
- 3Ask your app builder whether the app overrides or extends the user agent.
- 4Prefer feature detection and media queries wherever the goal is behavior rather than identification.
- 5Test the real string in your own build and after every rebuild.
Frequently asked questions
- What is the wv token in a user agent?
- It is the token Google says sites can look for to recognise an Android WebView. It appears in the default string, for example `Linux; Android 10; K; wv`, unless the app overrides the user agent.
- Does Android 17 change the WebView user agent?
- Google's December 2024 post says that beginning in Android 17 the default WebView user agent is reduced: OS, CPU and build details become fixed text and minor versions become 0.0.0. The wv token remains for default strings.
- Can an app hide that it is a WebView?
- Yes. Google says apps can set a custom user agent with setUserAgentString(), and those apps do not send the reduced string. A custom string may or may not contain wv.
- Does WebView support User-Agent Client Hints?
- Google says it has supported them since version 116, but only for apps that send the default user agent string.
- Is user agent detection reliable?
- MDN says it is very hard to do reliably and often causes bugs, and recommends feature detection instead. For WebView, the wv check is a reasonable hint but should not gate important features.