Skylsmoi
Skylsmoi

Reputation: 13

browser detection for safari 7

How can I detect if a browser is safari 7 and further versions using user agent ?

The method described here returns Safari 537.71 for a safari 7 browser. Is this safe to use for safari 7 ?

Upvotes: 0

Views: 555

Answers (1)

Saurabh Sinha
Saurabh Sinha

Reputation: 1800

<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>

I think this will solve your problem

Upvotes: 1

Related Questions