js怎么获取电脑硬件信息
发布时间:2016-12-09 17:18
相关话题
想知道怎么获取电脑的硬件信息吗,下面是小编带来js怎么获取电脑硬件信息的内容,欢迎阅读!
js怎么获取电脑硬件信息?
1、写一个js获取userAgent属性的html文件,文件内容如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
alert(window.navigator.userAgent);
</script>
</head>
<body>
<h1>测试浏览器类型</h1>
</body>
</html>

2、Chrome对应userAgent信息:

Chrome/后面紧跟的38.0...数字串为当前浏览器版本
3、FF对应userAgent信息

Firefox/后面紧跟的33.0为当前FF版本
4、IE对应userAgent信息;其中MSIE后面的数字代表当前版本,如图:笔者所有为ie9.0

另外, 只有IE支持创建ActiveX控件,因此她有一个其他浏览器没有的东西,就是ActiveXObject函数。只要判断window对象存在 ActiveXObject函数,就可以明确判断出当前浏览器是IE。
5、Opera对应userAgent信息:

OPR/后面紧跟的25.0...数字串为当前Opera浏览器版本
6、Safari对应userAgent信息

Version/后面紧跟的5.1.7为Safari浏览器当前版本
js怎么获取电脑硬件信息的评论条评论