[X]

DHTML Behaviors and .htc Files

browser wars 1999 dead

Internet Explorer let a stylesheet attach behaviour files to elements, mixing script into CSS on purpose.

In 2026: Dead. behavior: was IE only, ignored as an invalid property everywhere else, and IE10 removed it. The idea itself was not stupid, reusable components attached to markup came back years later as web components. The delivery mechanism, script loaded by a stylesheet, is exactly what Content Security Policy now exists to prevent.

Where it came from: Microsoft DHTML behaviors, Internet Explorer 5, MSDN, 1999. Wikipedia

<style>
/* Attach a script file to elements FROM CSS */
li  { behavior: url(collapse.htc); }
div { behavior: url(fader.htc), url(dragdrop.htc); }
</style>

<!-- collapse.htc, an HTML Component file, looked like this: -->
<!--
<PUBLIC:COMPONENT>
  <PUBLIC:ATTACH EVENT="onclick" ONEVENT="toggle()" />
  <SCRIPT LANGUAGE="JScript">
    function toggle() { ... }
  </SCRIPT>
</PUBLIC:COMPONENT>
-->

<ul><li>In IE5 this list item collapsed on click. Here it is a list item.</li></ul>
sandboxed demo · breaks nothing but itselfrestart

More in browser wars

all 19 in browser wars › · the whole library ›