|
Posted by Alan J. Flavell on 03/22/06 16:32
On Wed, 22 Mar 2006, Chris Sharman wrote:
> http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp
> Google for internet explorer conditional comments.
>
> Basically
> <!--[if IE]>Do yourself a favour - get <em>Firefox</em>.<![endif]-->
>
> Note that this is a syntactically valid html comment, ignored by all
> well-behaved browsers, but actioned by ie.
Indeed.
> Unfortunately the syntax for including something in other browsers &
> not ie is not valid (unsurprisingly).
> <[if !IE]>Happy Days<![endif]>
After I had devised a way of doing that with valid syntax, I found
that someone else had already done so, and had come up with a similar,
but slightly different, answer.
I haven't extensively tested either one (viz. I only tried IE6), but
this is its temporary working home, anyway :
http://ppewww.ph.gla.ac.uk/~flavell/tests/obj.html
Here's my recipe:
<!--[if !IE]>
-->
....content for www-compatible browsers...
<!--
<![endif]-->
The newlines are unlikely to be significant, I think - this
ought to function equally well
<!--[if !IE]> -->
[...content for www-compatible browsers...]
<!-- <![endif]-->
or maybe even the whitespace is redundant, I don't know.
Whereas, the technique from "Object Paranoia" goes like this, quoting
from their web page:
---
/
<!--[if !IE]> <-->
<p>
Content for everyone except Internet Explorer
</p>
<!--> <![endif]-->
\___
I really have no idea whether their extra pointy brackets are doing
anything beneficial.
Hope this is useful - let me/us know if there's something goes wrong
with one or the other in some situation that I hadn't tested.
thanks.
Navigation:
[Reply to this message]
|