x
1
<figure>
2
<figcaption>通过 navigator 获取浏览器详情</figcaption>
3
<pre>
4
function NavigatorExample() {
5
var txt;
6
txt = "Browser CodeName: " + navigator.appCodeName;
7
txt+= "Browser Name: " + navigator.appName;
8
txt+= "Browser Version: " + navigator.appVersion ;
9
txt+= "Cookies Enabled: " + navigator.cookieEnabled;
10
txt+= "Platform: " + navigator.platform;
11
txt+= "User-agent header: " + navigator.userAgent;
12
}
13
</pre>
14
</figure>
15