使用 Javascript 检测 Google Chrome 的安全基于功能的方法? [英] Safe feature-based way for detecting Google Chrome with Javascript?
问题描述
正如标题所述,我很想找到一种安全的基于功能(即,不使用 navigator.appName 或 navigator.appVersion)的方法来检测 Google Chrome.
As the title states, I'd be interested to find a safe feature-based (that is, without using navigator.appName or navigator.appVersion) way to detect Google Chrome.
我的意思是基于特征,例如:
By feature-based I mean, for example:
if(window.ActiveXObject) {
// internet explorer!
}
正如已经指出的那样,这个问题没有多大意义(显然,如果你想实现一个功能,你就测试它,如果你想检测一个特定的浏览器,您检查用户代理),抱歉,现在是凌晨 5 点;)让我这样说:是否有任何 javascript 对象和/或 Chrome 独有的功能...
As it's been pointed out, the question doesn't make much sense (obviously if you want to implement a feature, you test for it, if you want to detect for a specific browser, you check the user agent), sorry, it's 5am ;) Let me me phrase it like this: Are there any javascript objects and/or features that are unique to Chrome...
推荐答案
isChrome = function() {
return Boolean(window.chrome);
}
这篇关于使用 Javascript 检测 Google Chrome 的安全基于功能的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!