CMP Web Developer - Web Enthusiast - Web Loco

 

Posts for Category: Internet Explorer

  • Document Modes and JavaScript Support

    I just read a pretty cool article from the MSDN Blogs and basically it speaks to the fact that we, the developers, have complete control of the document mode that IE will use when rendering your code. By leveraging the right DOCTYPE and the correct X-UA-Compatible Meta tag or HTTP Header, you can force IE9’s new JavaScript engine, Chakra, to use the document mode you specify so that you can know, explicitly, which JavaScript features will be supported. I’ve copied the Chakra’s JavaScript support table from MSDN’s article. For the detailed article, please visit their post on IE’s Compatibility Features for Site Developers and the Determining Document Mode diagram for IE9.

    Document Mode Description
    IE9 standards IE9 standards document mode is the default if a Web page uses a standards-compliant DOCTYPE and doesn’t specify an X-UA-Compatible meta tag. In this mode, IE supports ECMAScript, Fifth Edition features, enhanced DOM programmability, and removes some of the key differences between our IE8 JavaScript implementation and the ECMAScript, Third Edition Specification.
    IE8 standards IE8 standards document mode supports the JavaScript additions we made in IE8 to implement portions of the then-draft ES5 standard, such as native JSON support and accessor support on DOM objects. This mode also supports the changes made in IE8 to fix some key issues raised by developers.
    IE7 standards IE7 standards document mode supports the JavaScript functionality that was available in IE7, including the Microsoft extensions supported in the IE7 standards mode in IE7 and IE8.
    Quirks Quirks mode supports the JavaScript functionality of IE6, and the Quirks mode of IE7 and IE8.
  • Task: Internet Explorer and specific CSS issues. How to target? Solution: For Internet Explorer related CSS issues you can go one of 3 ways.

    1. Try to find a way to resolve your layout strictly using CSS
    2. Use JavaScript to resolve the client’s browser and inject a new <link> element pointing to your IE specific stylesheet or
    3. Use a CSS Conditonal Statement that only Internet Explorer will invoke
    Implementation: <!—[if IE 6]> <link rel=“stylesheet” type=“text/css” href=“link-to-your-styleesheet.css” /> <![endif]—> There are a few of parameters you can use:
    • ‘gt’ which stands for greater than
    • ‘lte’ which stands for less than or equal to
    • ‘lt’ which stands for less than
    Here are a few examples: <!—[if lt IE 6]> If the client’s IE is less than version 6, this code here will get executed. <![endif]—> <!—[if gt IE 6]> If the client’s IE is less greater than version 6, this code here will get executed. <![endif]—> <!—[if lte IE 5.5]> If the client’s IE is less than or equal to 5.5, this code here will get executed. <![endif]—>

Copyright © 2004 - 2012 CMP Creations, LLC All rights reserved! Don't copy or steal stuff!