Search code examples
dreamweaverquirks-mode

Dreamweaver causing Quirks Mode in Internet Explorer


I use Dreamweaver to develop Web sites. I use the templates feature extensively as it helps to make things easier maintaining conformance.

However, I notice that Dreamweaver adds the following code before the doctype:

<!-- InstanceBegin template="/templates/web-public-user-home.dwt" codeOutsideHTMLIsLocked="false" -->

This is throwing my IE into Quirks mode for obvious reasons (i.e. comment before the doctype). Is there a way of dealing with this?! Below is my doctype.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Regards,


Solution

  • Ok, I figured this out.

    Because of the extensive IE-compliance tweaking I'm doing, I was using conditional comments. However, I was using them on the html tag. There's nothing wrong with this in principle but Dreamweaver won't handle your live template updates properly when you do this (It will place the Dreamweaver-specific template lock code first before the doctype, thereby ensuring that your pages will throw Quirks mode in IE).

    So what I did was move my conditional comment system away from the html tag, instead using them immediately after your opening body tag and immediately before your closing body tag like so:

    <body>
    <!--[if IE 6 ]> <div id="ie" class="ie6"> <![endif]-->
    <!--[if IE 7 ]> <div id="ie" class="ie7"> <![endif]-->
    <!--[if IE 8 ]> <div id="ie" class="ie8"> <![endif]-->
    <!--[if gt IE 8 ]> <div id="ie"> <![endif]-->
    <!--[if !IE]><div id="not-ie"> <![endif]-->
    
    {YOUR HTML CODE}
    
      </div>
    </body>
    

    This way, Dreamweaver places the doctype and html tag before the template lock code, and your resulting pages will appear in standards mode on IE (all things being normal).

    Cheers.