Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client hints for WebView-based apps #280

Open
dgstpierre opened this issue Dec 18, 2021 · 17 comments
Open

Client hints for WebView-based apps #280

dgstpierre opened this issue Dec 18, 2021 · 17 comments

Comments

@dgstpierre
Copy link

In the current user agent we have an indicator of 'wv' that assists with identifying web apps. As well as the web app adding it's identity. I don't see anything that accounts for this, looks like lost functionality.

@miketaylr
Copy link
Collaborator

In the current user agent we have an indicator of 'wv' that assists with identifying web apps.

Can you clarify what you mean by web apps? Do you mean native apps with a webview component?

@dgstpierre
Copy link
Author

Yes that is what I mean. The user agent currently has 'wv' in it to indicate.

@miketaylr
Copy link
Collaborator

Thanks, changing the title accordingly. This seems useful to consider.

@miketaylr miketaylr changed the title Identifying web apps Client hints for WebView-based apps Dec 20, 2021
@ronancremin
Copy link

Note that the Chromium blog stated that "have no plans to change the User-Agent string on Android WebView or Chrome for iOS at this time, but will make public updates if and when that changes."

So, by default, apps using the default Chrome-based Android webview ("Android System WebView") will presumably continue to behave as before—perhaps @miketaylr can confirm.

@miketaylr
Copy link
Collaborator

Correct, this is not an announcement that anything is changing from what is previously announced. To be clear, I'm saying it may be useful to consider a specific type of client hint to a webview.

@ronancremin
Copy link

Understood, thanks.

@dgstpierre
Copy link
Author

I wanted to check in on this with the user agent reduction coming for mobile devices in a few months. Will the user agent reduction remove wv? Or will it still be there to fall back on if user agent hints doesn't add a way to support it? Thanks

@Sora2455
Copy link

Sora2455 commented Nov 1, 2022

Why couldn't the browser just be listed as "Chrome WV" instead of "Chrome"?

@miketaylr
Copy link
Collaborator

I wanted to check in on this with the user agent reduction coming for mobile devices in a few months. Will the user agent reduction remove wv? Or will it still be there to fall back on if user agent hints doesn't add a way to support it? Thanks

The upcoming changes won't affect webview. Right now webview doesn't support client hints, which I consider a blocker for any UA reduction effort. But that will soon change (see https://groups.google.com/a/chromium.org/g/blink-dev/c/N_Y40YIHMtI). If and when we have a plan for webview reduction, we'll be sure to make it public and give devs plenty of time to prep for it/provide feedback, etc.

@miketaylr
Copy link
Collaborator

See also #219 (comment)

In particular we would like to see User-Agent Client Hints to indicate:

If the traffic is coming from a WebView
The source application that the browser session is coming from

The first would be covered by a hint that expressed "hey i'm a webview", and the second would be basically X-Requested-With, right? That was recently removed AFAIU: https://chromestatus.com/feature/5160086884843520

@jross1012
Copy link

That's right, it would be great to see this supported with Client Hints.

@miketaylr
Copy link
Collaborator

@Tanych
Copy link

Tanych commented Oct 6, 2023

the sec-ch-ua client hints already support to identify the traffic coming from WebView

for android it would be like:

  • Sec-CH-UA: "Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"
    for webview it would be like:
  • Sec-CH-UA: "Android WebView";v="117", "Chromium";v="117", "Not;A=Brand";v="8"

@Shivaansh-Agarwal
Copy link

The sec-ch-ua is available but it doesn't seem to be a reliable approach as some browsers still don't support it.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA#browser_compatibility

@bvattikonda
Copy link

Any update on this issue? Sec-CH-UA supports identifying traffic that is coming from webview. But, the issue of using client hints to identify source application remains unresolved.

@Tanych
Copy link

Tanych commented Jul 16, 2024

the app can override the user agent metadata to give their own client hints, e.g. they can add their own brand version: https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setUserAgentMetadata(android.webkit.WebSettings,androidx.webkit.UserAgentMetadata)

@bvattikonda
Copy link

Our request here is to make the contents of what used to be X-Requested-With a part of high entropy client hints by default. Unlike X-Requested-With the header will not be sent by default because it would be a high entropy client hint but at the same time it would be available for websites that would benefit from the value of the header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants