javascriptbrowser-detectionarc-browser

Can JavaScript detect the Arc browser?


The Arc browser is a new browser which used the Chromium engine and identifies itself as Chrome using a user agent string like this: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36.

Can JavaScript tell the difference between Arc and Chrome/Chromium? There must be something different about it.

My intention is to understand what browsers are being used by my audience in order to provide the best experience for them.


Solution

  • There is an Arc-specific CSS variable --arc-palette-title that you can check for:

    console.log(
        getComputedStyle(document.documentElement)
        .getPropertyValue('--arc-palette-title') ? 'Is Arc' : 'Is Not Arc'
    );
    

    Note: does not work while page is still loading.