I am looking at a piece of code which detects IE browser:
if (false || !!document.documentMode)
and I am not understanding the contraption. Why is it necessary to OR with false and use NOT twice?
If I simply loaded below file in IE9, FF or Opera, then IE would tell me that document mode was there, while the later two would say otherwise:
<html>
<head>
<script>function ld() {
if (document.documentMode){
document.getElementById("p1").innerHTML = 'Document Mode detected'
}
else {
document.getElementById("p1").innerHTML = 'No Document Mode'
}
}</script>
</head>
<body onload="ld()">
<p id="p1"></p>
</body>
</html>
Is that not sufficient and why? It is not clear, because if I replaced the condition with the one in my original question, the result would be exactly the same. What am I missing?