navigator.userAgent
<p>I am trying to detect if the browser is Safari.  If so, only then do something.  In all other browsers, do something else:</p>

<pre><code>if ( navigator.userAgent.toLowerCase().indexOf('safari') == -1) {
    //if safari execute some function
} else {
   // if other browsers execute other function
}
</code></pre>

<p>However, I guess I am not using the right approach because it's not working. :P</p>
