I read a book calls 'Professional Javascript For Web Developers 2nd edition' and it state that this code can detect browser rendering engine:
<script type="text/javascript">
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 > 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");
}
</script>
but it seems like doesn't work, so how this code work to detect browser rendering engine?Thanks