Circumventing Internet Explorer, Again

I never used this practically, but in case anybody is working on a website design and needs to block an entire stylesheet from Internet Explorer, try the following hack:

Add noie or any other arbitrary word that is a valid media name but would not confuse any clients to the media declaration. So <link rel="stylesheet" href="mystyle.css" type="text/css" media="screen print"> becomes <link rel="stylesheet" href="mystyle.css" type="text/css" media="screen print noie">. This works with <link>, <style>, and @import (for the latter two use commas instead of whitespace) but not with @media selectors.

Most browsers will see the "noie" media type, decide that it does not match them, and go on to the next one. Internet Explorer has a bug that causes it to completely ignore that stylesheet.

This was asked close to a year ago and as far as I know it has not been answered.

Latest entries to this site

Info

This was written on Tuesday, March 16, 2004 by Lenny.

Comments

Read 0 and add your own.