Since navigator.userAgent's information will be reduced so I want to migrate to User-Agent Client Hints but it shows error like this:
How do I solve this, please help. Many thanks
CodePudding user response:
TypeScript doesn't ship with type declarations for the experimental Navigator.userAgentData
property by default.
You could install e.g. this package which claims to add the types or just look at its implementation to see how to write the declarations yourself.
CodePudding user response:
A page or script is accessing at least one of navigator.userAgent, navigator.appVersion, and navigator.platform. Starting in Chrome 101, the amount of information available in the User Agent string will be reduced.
Note that for performance reasons, only the first access to one of the properties is shown.
So plz check if you already used one of the above properties before userAgentData. Also please refer this.