title: How to detect browser rendering engine in javascript?
body: <p>I read a book calls 'Professional Javascript For Web Developers 2nd edition' and it state that this code can detect browser rendering engine:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
    var client = function(){
       var engine = {
          ie: 0,
          gecko: 0,
          webkit: 0,
          khtml: 0,
          opera: 0,
  
          ver: null
       };
  
       return {
          engine : engine  
       };
  
    }();
  
    if(client.engine.ie){
        alert("This is internet explorer");
    }else if(client.engine.gecko &gt; 1.5){
        if(client.engine.ver == "1.8.1"){
            alert("This is gecko rendering browser");
        }
    }else if(client.engine.webkit){
          alert("This is web kit");
    }else if(client.engine.khtml){
         alert("This is khtml");
    }else{
         alert("none of the above");
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>but it seems like doesn't work, so how this code work to detect browser rendering engine?Thanks</p>