安全基于特征的检测谷歌浏览器的JavaScript的方式? [英] Safe feature-based way for detecting Google Chrome with Javascript?
问题描述
正如标题状态,我很想找到一个安全的基于特征的(即不使用navigator.appName或navigator.appVersion)的方式来检测谷歌浏览器。
通过基于特征的我的意思,例如:
如果(window.ActiveXObject){
// IE浏览器!
}
编辑:由于它已经指出的那样,这个问题并没有多大意义(当然,如果你想实现一个功能,您测试它,如果你要检测一个特定的浏览器,你检查用户代理),对不起,这是上午05点;)让我那句我像这样:有特有的Chrome浏览器...任何JavaScript对象和/或功能
isChrome =功能(){
返回布尔(window.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!
}
Edit: 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的方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!