Forum Moderators: open

Message Too Old, No Replies

Browser Targeted Conditional Comments

Targetting specific browsers with Condtional Comments

         

takuhii

8:35 am on Jul 22, 2009 (gmt 0)

10+ Year Member



Hi,
Why are Conditional comments IE orientated? I would like to be able to target specific versions of Firefox for a HTML5 project I am working on, how can I say if not Firefox 3.5 then should alternate content?

Any ideas, help would REALLY be appreciated
Darren

swa66

9:43 am on Jul 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Microsoft invented conditional comments. To a real standards compliant browser they are simply and purely comments.

takuhii

9:54 am on Jul 22, 2009 (gmt 0)

10+ Year Member



I see. Is there anyway I could target specific versions of Firefox with specific stylesheets?

Regards
Darren

tedster

8:49 pm on Jul 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could use a javascript browser sniffer, and then use document.write to include the appropriate stylesheet.

You would probably start with one basic stylesheet and then introduce the ones with specific tweaks further along the cascade.

The conditional comment aprpoach was invented by IE because their crippled browser required it so often. firefox is most often quite well behaved so there is no proprietary approach that I know of. There's a very thorough Browser Sniffer post in this thread: [webmasterworld.com...] - that's from 2001, back when we really needed it.

takuhii

7:45 am on Jul 23, 2009 (gmt 0)

10+ Year Member



I was hoping to avoid Javascript, but it is becoming more and more inevitable.

I want to incorporate HTML5 tweaks into some of my pages, but IE is obviously HTML5 mute... So want to provide alternative styling/code...