简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM