Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distinguish between chrome and chromium using Javascript

Is it possible to distinguish Google Chrome from the open source Chromium browser using Javascript? The navigator.userAgent property seems to be identical in both browsers.

like image 805
cronoklee Avatar asked Oct 22 '22 15:10

cronoklee


1 Answers

You may not want to just check for Chromium because Google Chrome's PDF plugin can also be used in Chromium (by simply copying the .dll file). In fact, I'm using it right now.

The best way is to check for the Chrome PDF plugin, using window.navigator.plugins:

var pdf = false;
for (i in window.navigator.plugins) {
    if (window.navigator.plugins[i].name === "Chrome PDF Viewer") {
        pdf = true;
    }
}

If you want to use the filename instead of the name, it's "pdf.dll" (on Windows machines).

like image 199
Alfred Xing Avatar answered Oct 26 '22 23:10

Alfred Xing