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

Prepare for Chrome User-Agent reduction #225

Closed
prsdthkr opened this issue Mar 11, 2022 · 1 comment · Fixed by #301 or #302
Closed

Prepare for Chrome User-Agent reduction #225

prsdthkr opened this issue Mar 11, 2022 · 1 comment · Fixed by #301 or #302

Comments

@prsdthkr
Copy link

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/

@remarkablemark
Copy link
Owner

Given Internet Explorer 11 (IE) is going to be deprecated on June 15, 2022, I think it'll be easier to remove IE-related code.

@remarkablemark remarkablemark pinned this issue Mar 14, 2022
remarkablemark added a commit that referenced this issue Jun 18, 2022
BREAKING CHANGE: remove Internet Explorer (IE11) support

Internet Explorer has been retired on 2022-06-15

Closes #225
@remarkablemark remarkablemark unpinned this issue Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants