W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2008

Re: Using DOM to replace media attribute in the link tag on page load

From: Patrick Garies <pgaries@fastmail.us>
Date: Wed, 23 Jul 2008 07:36:32 -0500
Message-ID: <488725D0.2050507@fastmail.us>
To: David Perrell <davidp@hpaa.com>
CC: www-dom@w3.org

David Perrell wrote:
>  I'm still seeing a lot of pre-XP Windows with IE < 7 in my web server
>  logs. It'll be a while before implementation of that change is a
>  good idea.

I said “up to version 7”, so that includes version 7 itself too. The way 
that I implement it is by use of conditional comments:

|<!--[if !IE]>-->
<script type="application/ecmascript">
    // do something
</script>
<!--<![endif]-->
<!--[if IE]>
    <script type="text/ecmascript">
       // do something
    </script>
<![endif]-->|

Alternatively, the following works if you want to combine embedded 
scripts (with tracks for WIE and non‐WIE browsers):

|<!--[if !IE]>-->
<script type="application/ecmascript">
    // <!--<![endif]--> <script type="text/ecmascript">
    // do something
</script>|

Admittedly, this is extra work for something that seems to be mostly 
cosmetic.

Hopefully, WIE8 will support the two new MIME types so that the 
messiness above can eventually be done away with. (I’m not willing to 
test pre‐release software on this computer to find out if this issue is 
fixed in WIE 8 Beta 1 though.)

— Patrick Garies
Received on Wednesday, 23 July 2008 12:37:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:59 GMT