function checkChrome(flavor = 'google-chrome') {
  if (isServer) {
    return flavor === 'google-chrome';
  }

  // eslint-disable-next-line prefer-destructuring
  const navigator = /** @type {Navigator & {userAgentData: {brands:{brand:string}[]}}} */ (
    globalThis.navigator
  );

  const isChromium =
    !!navigator.userAgentData &&
    navigator.userAgentData.brands.some(data => data.brand === 'Chromium');

  if (flavor === 'chromium') {
    return isChromium;
  }

  const winNav = globalThis.navigator;
  const vendorName = winNav?.vendor;
  const isOpera =
    typeof (/** @type {window & { opr?: boolean}} */ (globalThis).opr) !== 'undefined';
  // @ts-ignore
  const isIEedge = globalThis.userAgent?.indexOf('Edge') > -1;
  // @ts-ignore
  const isIOSChrome = globalThis.userAgent?.match('CriOS');

  if (flavor === 'ios') {
    return isIOSChrome;
  }

  if (flavor === 'google-chrome') {
    return (
      isChromium !== null &&
      typeof isChromium !== 'undefined' &&
      vendorName === 'Google Inc.' &&
      isOpera === false &&
      isIEedge === false
    );
  }

  return undefined;
}
From https://stackoverflow.com/questions/4565112/javascript-how-to-find-out-if-the-user-browser-is-chrome
@param {string} [flavor='google-chrome']