At Creative Calls, we analyze hundred of web pages from all around the web. During our daily work, we face every possible browser quickiness and web hack known to mankind. Here’s one of the issues we’ve have the pleasure to deal with – appropriately enough, we’ve named it The META Content-Type Refresh Bug.
Here’s a code sample:
<html>
<head>
<script type="text/javascript">
alert("hello");
</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
</body>
</html>
What does this code do when opened for the first time in Internet Explorer? Apparently not what most people think it would do. Click here to see for yourself (make sure you’re using IE7).
To be fair, MSDN has the following advice on this issue:
To apply a character set to an entire document, you must insert the meta element before the body element. For clarity, it should appear as the first element after head, so that all browsers can translate the meta element before the document is parsed.
Though warning against the behavior of web browsers in general, it fails to specifically address the weird behavior exhibited by IE. But it wouldn’t have helped us anyway since we didn’t even know what to look for.