cronoklee
cronoklee

Reputation: 6722

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.

Upvotes: 6

Views: 1668

Answers (1)

Alfred Xing
Alfred Xing

Reputation: 4632

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).

Upvotes: 3

Related Questions