-
-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Description
Chrome is changing how much userAgent data they expose to the browser. Usage of navigator.userAgent in https://github.com/remarkablemark/html-dom-parser/blob/master/lib/client/utilities.js#L138 will throw browser warnings in the future.
Possible solution
something like
function isIE() {
const reducedUAString = navigator?.userAgentData?.brands
?.map?.(
({ brand, version }) => (`${brand}/${version}`),
)?.join?.(' ');
// for other browsers
if( !reducedUAString ) {
return /(MSIE |Trident\/|Edge\/)/.test(navigator.userAgent);
} else {
// for chrome
return /(MSIE |Trident\/|Edge\/)/.test(reducedUAString);
}
}Additional context
User-Agent (UA) reduction is the effort to minimize the identifying information shared in the User-Agent string which may be used for passive fingerprinting. As these changes are rolled out, all resource requests will have a reduced User-Agent header. As a result, the return values from certain Navigator interfaces will be reduced, including: navigator.userAgent, navigator.appVersion, and navigator.platform.
https://developer.chrome.com/docs/privacy-sandbox/user-agent/
jbadan
Metadata
Metadata
Assignees
Labels
No labels