/WebKit/.test(navigator.userAgent); //true / false
//only Safari - Chrome has both 'Chrome' and 'Safari' inside userAgent string.
if (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1) {
alert('It\'s Safari');
}