Search code examples
quirks-modehtml-components

Why my HTC files are not loading in IE quirks mode


I have a large legacy web app that uses HTC behavior in CSS. For example,

.tabButtons
{
    BEHAVIOR: url(/Echo/common/behaviors/tabPanel.htc);
}

This will work in IE 11, but I must go to Compatibility View Settings and add the domain.

It is possible to use CSS behavior another way?

I tried to put

<meta http-equiv="X-UA-Compatible" content="IE=5">

at the top of the page head. This seems to invoke quirks mode, because when I do alert("compatMode = " + document.compatMode) then it says BackCompat.

However the CSS behavior still does not work. It does not even attempt to fetch the file tabPanel.htc.

What else can I try?


Solution

  • Support for element behaviors and HTML components (HTCs) has been removed in Internet Explorer 10 standards and quirks modes for improved interoperability and compliance with HTML5. This means elements previously bound to Element Behaviors or HTCs will be treated as generic elements, just like in other browsers. This change can impact pages written exclusively for Windows Internet Explorer or pages that use browser sniffing to alter their behavior in Internet Explorer.

    Try add the following meta tag near the top of the page to opt into Internet Explorer 9 behavior:

    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">
    

    Source: https://msdn.microsoft.com/en-us/library/hh801216(v=vs.85).aspx

    You could always try using a strict doctype, rather than transitional. i.e:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    

    Though these are workarounds, revising the code would be the best solution.