web-serial-rxjs API Documentation
    Preparing search index...

    Function detectBrowserType

    • Detect browser type from the user agent string.

      Analyzes the browser's user agent string to identify the browser type. This function is useful for providing browser-specific functionality or error messages.

      Returns BrowserType

      The detected BrowserType, or BrowserType.UNKNOWN if the browser cannot be identified

      const browserType = detectBrowserType();
      switch (browserType) {
      case BrowserType.CHROME:
      console.log('Running in Chrome');
      break;
      case BrowserType.EDGE:
      console.log('Running in Edge');
      break;
      case BrowserType.OPERA:
      console.log('Running in Opera');
      break;
      default:
      console.log('Unknown browser');
      }

      isChromiumBased for checking if the browser is Chromium-based