概述
As we all know, Google's Chrome browser hit the web yesterday. Whether you wanted to or not, you definitely downloaded Google's effort to see what ingenuity they put into their browser. It's clean, fast, and more stable than Firefox has been for me lately. Of course, there's always a chance that Chrome will have a quirk that none of the other browsers have and you may need to use client side detection to fix the problem. You can detect Chrome by using the following bit of JavaScript: 众所周知,Google的Chrome浏览器是昨天在网上发布的。 无论您是否愿意,您都一定下载了Google的工作成果,以了解他们在浏览器中的独创性。 它比Firefox最近对我来说干净,快速且稳定。 当然,Chrome总是有可能会出现其他浏览器都没有的怪癖,您可能需要使用客户端检测来解决此问题。 您可以使用以下JavaScript来检测Chrome: The following string represents Chrome's full user agent: 以下字符串代表Chrome的完整用户代理: Have any Chrome-specific functionality you want to build? Maybe a MooTools slide-in script that says "Hey, you're using Google's new browser!" It's probably too soon to try to fix Chrome-related bugs, but knowing how to detect it sooner rather than later is a good thing. 您要构建任何特定于Chrome的功能吗? 也许是MooTools的滑入脚本,上面写着“嘿,您正在使用Google的新浏览器!” 尝试修复与Chrome相关的错误可能为时过早,但是知道如何尽早检测出它是一件好事。 翻译自: https://davidwalsh.name/detecting-google-chrome-javascriptvar is_chrome = window.chrome;
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13
最后
以上就是爱笑楼房为你收集整理的使用JavaScript检测Google Chrome的全部内容,希望文章能够帮你解决使用JavaScript检测Google Chrome所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复