« Katana can cut a bullet | Glass Toilets » |
One of the biggest grief in web development is fixing these minor quirks between Internet Explorer and Mozilla based browsers like Firefox. Microsoft then makes it more difficult with more quirks between IE5, IE6 and IE7. To give Microsoft some credit, they seem to have genuinely tried to make IE7 more standards compliant than its predecessors. Just yesterday, Conditional Comments placed in my code for adding addition JavaScript code to fix IE quirks gave me some grief. Let me explain further…
In IE, there is a feature called Conditional Comments which simply allows you to add comments in the following format:
<!–[if IE 7]>
<script>
alert("This is IE 7");
</script>
<![endif]–>
In short, these comments are ignored by most other standards compliant browsers but are recognized and processed by IE.
More info on Conditional Comments here http://www.quirksmode.org/css/condcom.html
(no this is not a condom site)
However, this becomes a problem on IE when content with JavaScript code is retrieved via AJAX. This is because most AJAX frameworks such as HTML_AJAX will scan through the content and extract code within the <script> tags ignoring the comment conditions. This has been verified on HTML AJAX 0.5.0 and hopefully some other frameworks do not have this problem or have since fixed it.
My solution to this problem involved adding conventional JavaScript based checks instead such as http://dean.edwards.name/weblog/2007/03/sniff/ for detecting IE and http://ajaxian.com/archives/detecting-ie7-in-javascript for detecting IE7