如何使用Html代码检测我的浏览器版本和操作系统?

时间:2014-04-17 05:31:58

标签: javascript jquery html css html5

代码应该出现在浏览器OUTPUT中,如

浏览器名称:Netscape

浏览器版本:5.0 平台/操作系统:Win32 / linux / mac

1 个答案:

答案 0 :(得分:0)

你无法使用CSS但可以使用JavaScript

http://www.w3schools.com/js/js_window_navigator.asp

<script>

txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
txt+= "<p>Browser Name: " + navigator.appName + "</p>";
txt+= "<p>Browser Version: " + navigator.appVersion + "</p>";
txt+= "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
txt+= "<p>Platform: " + navigator.platform + "</p>";
txt+= "<p>User-agent header: " + navigator.userAgent + "</p>";
txt+= "<p>User-agent language: " + navigator.systemLanguage + "</p>";

console.log(txt);

</script>