View Single Post
Old 7th May 2006, 15:57   #22
Forum King
Join Date: Mar 2004
Posts: 3,069
PulseDriver, you don't understand. I know things like Opera include MSIE in their UA string, but conditional comments have nothing to do with the UA string. For example:
<!--[if lte IE 6]><link rel="stylesheet" type="text/css" href="ie.css" /><![endif]-->

These will look like normal comments to most browsers. But they're specific to IE and IE only supports them. So everything except IE will ignore them. In the example above, only versions of IE less than or equal to 6 will use ieonly.css. So IE 7 will ignore it.

Browser sniffing with PHP is quite easy, but still a bit messy particularly because Opera can identify itself as Mozilla/IE/Opera (user's choice) and you can change the UA string in many Gecko-based browsers by some simple tinkering with the config. So if your intention is to target IE alone, conditional comments are the way forward.
Wolfgang is offline   Reply With Quote