Skip to content

Device plugin Web implementation should use User-Agent Client Hints API for supported browsers #509

@KevinKelchen

Description

@KevinKelchen

Feature Request

Plugin

Device (Web implementation)

Description

Chromium is planning to freeze and reduce the data in the web browser's user agent string beginning in 2021.

As a user of the Capacitor Device plugin, I noticed that the Web implementation parses the user agent string and doesn't use the new User-Agent Client Hints API for supported/Chromium browsers. This means at some point the information provided by the Device plugin's Web implementation may no longer be as accurate as it could be.

Platform(s)

Web

Preferred Solution

For web browsers that support the User-Agent Client Hints API, use that API instead of parsing the user agent string. If the User-Agent Client Hints API is not present in the browser's runtime environment, fall back to the existing implementation of parsing the user agent string.

Alternatives

Additional Context

A post on migrating to the new API can be found here.

As another reference, there is likewise an open issue for the popular ua-parser-js library asking about supporting the User-Agent Client Hints API as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions