Andy Jarrett // Code. Develop. Create.

Conditional Comments to detect IE

I don't why i haven't seen this around before, or its not well documented as it would of solved lots of problems in the "IS IE" Js detection scripts from the browser wars. Anyway, in a nutshell IE 5+ excepts HTML conditional comments, just try running the following code:
<!--[if gte IE 5.5]>
\n<SCRIPT LANGUAGE="Javascript">
\nalert("Congratulations. You are running IE5 or later!");
\n</SCRIPT>
\n<P>Thank you for closing the message box.</P>
\n<![endif]-->

Probably not as usefull now, what with browsers becoming more standards compliant, but still, handy to have in the tool bag.

I’m here, learning and working away. If you liked this content and want to keep me going, consider buying me a coffee. Your support keeps this site running and the coffee brewing! ☕️