How do I detect Chromium specifically vs. Chrome?

Chrome ships with a built-in PDF reader, Chromium doesn't.
You could detect this by using JavaScript:

function isChrome() { // Actually, isWithChromePDFReader
    for (var i=0; i<navigator.plugins.length; i++)
        if (navigator.plugins[i].name == 'Chrome PDF Viewer') return true;
    return false;
}

This method is not 100% reliable, because users can copy the PDF reader binary from Chrome to their Chromium directory, see this answer on Ask Ubuntu.

There's almost no difference between Chromium and Chrome (certainly not in the rendering or JavaScript engine), so why do you want to spot the difference?


Starting with Chromium 84 there's a new method called User-Agent Client Hints reference

You can check if the userAgentData property exists and look for brand data. It will return an array that looks something like this.

[{
    "brand": " Not;A Brand",
    "version": "99"
}, {
    "brand": "Google Chrome",
    "version": "91"
}, {
    "brand": "Chromium",
    "version": "91"
}]

userAgentData.brands will contain varying values in a varying order, so don't rely on something appearing at a certain index. Instead check if the property exists in the array.

if (navigator.userAgentData) {
    let vendors = window.navigator.userAgentData.brands;
    if (vendors.filter(e => e.brand === 'Google Chrome').length > 0) {
        console.log('Chrome')
    } else {
        console.log('Chromium')
    }
}

Note:
This no longer works, because now all Chrome-based-navigators have all plugins.

New Chromium-versions do have the PDF-plugin, too.
But they also have Chromium-plugins, so if any plugin starts with "Chromium", it's Chromium:

function isChromium() {

  for (var i = 0, u = "Chromium", l = u.length; i < navigator.plugins.length; i++) {
    if (navigator.plugins[i].name != null && navigator.plugins[i].name.substr(0, l) === u)
      return true;
  }

  return false;
}

Also, use this to identify Microsoft Chredge (aka. Anaheim)

function isEdg() {

  for (var i = 0, u = "Microsoft Edg", l = u.length; i < navigator.plugins.length; i++) {
    if (navigator.plugins[i].name != null && navigator.plugins[i].name.substr(0, l) === u)
      return true;
  }

  return false;
}