Check the browser with JavaScript
<pre><code>var user = navigator.userAgent;
var browser = {};
browser.opera = user.indexOf("Opera") &gt; -1 &amp;&amp; typeof window.opera == "object";
browser.khtml = (user.indexOf("KHTML") &gt; -1 || user.indexOf("AppleWebKit") &gt; -1 || user.indexOf("Konqueror") &gt; -1) &amp;&amp; !browser.opera;
browser.ie = user.indexOf("MSIE") &gt; -1 &amp;&amp; !browser.opera;
browser.gecko = user.indexOf("Gecko") &gt; -1 &amp;&amp; !browser.khtml;
if ( browser.ie ) {
    var ie_reg = /MSIE (\d+\.\d+);/;
    ie_reg.test(user);
    var v = parseFloat(RegExp["$1"]);
    browser.ie55 = v &lt;= 5.5;
    browser.ie6  = v &lt;= 6;
}
</code></pre>

<p>Recently, I am leaning JavaScript. I saw some code to check the browser, but I can't follow it well. The code is too hard for me. Can explain it to me? Many thanks.</p>
