All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.lib.utils.userAgent.js.flow Maven / Gradle / Ivy

There is a newer version: 2.11.8
Show newest version
// @flow
type Navigator = Navigator & { userAgentData?: NavigatorUAData };

interface NavigatorUAData {
  brands: Array<{ brand: string, version: string }>;
  mobile: boolean;
  platform: string;
}

export default function getUAString(): string {
  const uaData = (navigator: Navigator).userAgentData;

  if (uaData?.brands) {
    return uaData.brands
      .map((item) => `${item.brand}/${item.version}`)
      .join(' ');
  }

  return navigator.userAgent;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy