I can't understand this simple JS code
<p>I can't understand this code. If this is a RegExp, can it be done in a simpler way? Or is this already widely compatible? (with IE6 and newer browsers)</p>

<pre><code>var u = navigator.userAgent;

// Webkit - Safari
   if(/webkit/i.test(u)){
// Gecko - Firefox, Opera
   }else if((/mozilla/i.test(u)&amp;&amp;!/(compati)/.test(u)) || (/opera/i.test(u))){
   }
</code></pre>

<p>Is this just:</p>

<pre><code>String.indexOf("webkit")
</code></pre>
