Friday, June 03, 2005

IE Stopper XHTML Code

I've just stumbled upon a piece of XHTML code in a discussion I've been reading that causes Internet Explorer not to show the page, but it's correctly rendered in Mozilla, for example. Thus, the code:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <title>I won't run on IE. I'm amazing :)</title>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=iso-8859-1" />
    <script src="randomfoobar.js" type="text/javascript" />
    <!--The magic bit is the XML-compliant ending on the <script> tag. IE dies when it encounters this...-->
  </head>
  <body>
    <h1>You cannot see this using IE.</h1>
    <hr />
    So if you're reading this, then you must be smart.
  </body>
</html>

I've tested it and it doesn't show in IE on my Windows XP computer, but it does work with Mozilla.
I'm thinking about "decorating" the template of my blog with this trick, muahahahaaaaa...

0 Comments:

Post a Comment

<< Home