2013-11-22 246 views
0

如何檢測瀏覽器是否爲Safari 7以及使用用戶代理的更多版本?Safari瀏覽器檢測7

描述的方法here爲safari 7瀏覽器返回Safari 537.71。這是安全的用於Safari 7嗎?

回答

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> 

我認爲這將解決您的問題

+0

它並沒有解決它,但它幫助。我通過在控制檯中瀏覽導航器找到了解決方案。 – Skylsmoi

+0

如果你可以請打勾,如果它幫助你或upvote;) –