1 2 3 4 |
var is_ie/*@cc_on = { // quirksmode : (document.compatMode=="BackCompat"), version : parseFloat(navigator.appVersion.match(/MSIE (.+?);/)[1]) }@*/; |
(Uncomment the second line if you also wish to check whether IE is running in “compatibility” (quirks) mode or in standards-mode.) All other browsers cheerfully ignore the Javascript comment block (/* … */) so what they end up with is essentially this: var is_ie; …which evaluates as an implicit false, when used as …