<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>navigator</title>
</head>
<body>
</body>
<script type="text/javascript">
//浏览器嗅探
console.log(window.navigator);
//代表浏览器中安装的插件
console.log(window.navigator.plugins);
//当前浏览器的版本/信息
console.log(window.navigator.userAgent);
//通过userAgent来判断浏览器是哪一种浏览器
if(window.navigator.userAgent.indexOf("Chrome")!=-1){
console.log("这是谷歌浏览器") ;
}
</script>
</html>
网友评论