How do I detect Chromium specifically vs. Chrome? How do I detect Chromium specifically vs. Chrome? google-chrome google-chrome

How do I detect Chromium specifically vs. Chrome?


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;}


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?


Here is a variation to Paul W.'s answer that works for Chromium version 42 and above:

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

This of course only works if the plugin has not been disabled by the user.