Approach 1:
Note: Since JQuery 1.3, jQuery.browser is deprecated
Try this :
<!DOCTYPE html>
<html>
<head>
<style>
p { color:green; font-weight:bolder; margin:3px 0 0 10px; }
div { color:blue; margin-left:20px; font-size:14px; }
span { color:red; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<p>Browser info: (key : value)</p>
<script>
jQuery.each(jQuery.browser, function(i, val) {
$("<div>" + i + " : <span>" + val + "</span>")
.appendTo( document.body );
});</script>
</body>
</html>
Approach 2:
// A quick solution without using regexp (to speed up a little).
var userAgent = navigator.userAgent.toString().toLowerCase();
if ((userAgent.indexOf('safari') != -1) && !(userAgent.indexOf('chrome') != -1)) {
alert('We should be on Safari only!');
}