gueschla.com/2007/03/29/ie-browser-sniffing

post 07 of 32 · 29 March 2007 · written in French

Sniffing Internet Explorer in one line

IE browser sniffing

The shortest Internet Explorer test the author had seen, from Dean Edwards: var isMSIE = /*@cc_on!@*/false;. Only IE ran code inside its conditional-compilation comments, so only IE saw the ! and got true. The post trims it further to /*@cc_on!@*/0.

ie-browser-sniffing.fr29 March 2007 · 16:07

Comment détecter qu’un utilisateur utilise Internet Explorer ?

Dean Edwards nous propose la méthode la plus courte (en terme de code ;-) ) que j’ai eu l’occasion de voir.

var isMSIE = /*@cc_on!@*/false;

Bon, si on veut, on peut même faire plus court …

var isMSIE = /*@cc_on!@*/0;

Tester

Original French text from Internet Archive captures of gueschla.com. Light typo fixes only. Links to outside sites are shown as plain text, because most of those 2007 addresses no longer lead where they did.