浏览器检测safari 7

时间:2013-11-22 11:34:35

标签: javascript jquery safari user-agent

如何使用用户代理检测浏览器是否为safari 7以及更多版本?

描述的方法here为safari 7浏览器返回Safari 537.71。这可以安全地用于safari 7吗?

1 个答案:

答案 0 :(得分:1)

<body>
<div id="example"></div>

<script>
console.log(navigator);
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>Browser Language: " + navigator.language + "</p>";
txt+= "<p>Browser Online: " + navigator.onLine + "</p>";
txt+= "<p>Platform: " + navigator.platform + "</p>";
txt+= "<p>User-agent header: " + navigator.userAgent + "</p>";
txt+= "<p>User-agent language: " + navigator.systemLanguage + "</p>";

document.getElementById("example").innerHTML=txt;

</script>

 </body>
</html>

我认为这将解决您的问题