如何检测Chromium与Chrome的对比情况? [英] How do I detect Chromium specifically vs. Chrome?

查看:197
本文介绍了如何检测Chromium与Chrome的对比情况?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法检测我网站的访问者是否运行 Chromium 而不是 Google Chrome ?即使基本的UA嗅探(我知道这是不好的做法)也足以满足我的特殊情况,但似乎Chromium和Chrome 共享相同的UA字符串 - 是否正确?有没有其他方法可以区分两者?

解决方案

Chrome浏览器内置PDF阅读器,Chromium doesn '
$ b

 函数isChrome(){//实际上, ,isWithChromePDFReader 
for(var i = 0; i< navigator.plugins.length; i ++)
if(navigator.plugins [i] .name =='Chrome PDF Viewer')return true;
返回false;
}

这种方法不是100%可靠的,因为用户可以复制PDF阅读器二进制文件从Chrome浏览器到他们的Chromium目录,请参阅 Ask Ubuntu 上的这个答案。



Chromium和Chrome几乎没有什么区别(当然不是在渲染或JavaScript引擎中),那么为什么要发现它们之间的差异呢?


Is there a way to detect if a visitor to my site is running Chromium as opposed to Google Chrome? Even basic UA sniffing (which I know is bad practice) would suffice for my particular case, but it appears that Chromium and Chrome share the same UA string – is that correct? Is there any other way that I can differentiate between the two?

解决方案

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?

这篇关于如何检测Chromium与Chrome的对比情况?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆