GoogleChromeLabs / GoogleChromeLabs/bubblewrap
Ability to modify the WebView User-Agent
- Dominant language
- TypeScript
- Stars
- 3.1k
- Forks
- 319
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
It is not entirely straightforward to detect whether a user is using a WebView-fallback, especially if the application is replacing an older WebView-based application, or to differentiate from users opening the website in a third-party WebView-sandbox app.
**Describe the solution you'd like**
We would like to be able to append the WebView's User-Agent with app-information, such as "MyTwaApplication/12.5.2" through the Bubblewrap-manifest:
```json
{
...
"userAgentSuffix": "MyTwaApplication/12",
...
}
```
or preferably with templating for app version (which is already in the manifest):
```json
{
...
"appVersionName": "12",
"userAgentSuffix": "MyTwaApplication/{appVersionName}",
...
}
```
or something similar.
**Describe alternatives you've considered**
We have considered attempting to detect WebView using the normal user-agent, which would not provide version-information.
An alternative for version might be the launch-url, but that seems to be error-prone and only limited to the initial load.
**Additional context**
This is related to another issue I have created. I will update with the issue-number in a moment.
**Edit:** Issue #924
Contributor guide
Assessment
This issue has not been assessed yet.