从控制台检查Chrome版本 [英] check chrome version from console

查看:871
本文介绍了从控制台检查Chrome版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从控制台检测Google Chrome的版本. 我知道我可以解析用户代理字符串-但我更喜欢一种更简洁的方法.

Is there a way to detect Google Chrome's version from the console. I know I can parse the user agent string - but I prefer a more concise way.

这是我目前拥有的:

var uaStr = navigator.userAgent.toLowerCase();
var index = uaStr.indexOf('chrome/');
uaStr.substring(index +7,index+11);

我想知道是否有更好的方法-如chrome.version()

I would like to know if there's a better way - something like chrome.version()

谢谢.

推荐答案

在Chrome DevTools控制台中,执行以下语句:

In Chrome DevTools Console execute the following statement:

 > navigator.appVersion.match(/.*Chrome\/([0-9\.]+)/)[1]

您将获得版本号作为字符串

And you will get the version number as a string

 > "51.0.2704.103"

这篇关于从控制台检查Chrome版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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