JSXGraph and IE8

Yesterday, Internet Explorer 8 was released. Unfortunately, displaying JSXGraph with IE 8 fails, if IE 8 runs in strict mode and the HTML file starts with DOCTYPE. Meanwhile, the problem has been localized: Up to IE7 the VML rendering engine is initialized with the commands

document.namespaces.add("v", "urn:schemas-microsoft-com:vml");
document.createStyleSheet().addRule("v\\:*", "behavior: url(#default#VML);");

In IE8, the wildcard

...addRule("v\\:*", ...

is not longer allowed. Here is an example. There are some solutions proposed by several groups, among them people from Microsoft.

  • Using

    document.namespaces.add(“v”, “urn:schemas-microsoft-com:vml”, “#default#VML”);

does not throw an error, but the dynamically constructed elements are not displayed correctly.

  • The other tip was to use

    if(!document.documentMode || document.documentMode<8) { document.createStyleSheet().addRule(“v\:*”, “behavior: url(#default#VML);”); } if(document.documentMode && document.documentMode>=8) { document.writeln(‘’); }

which also did not help.

The quick and dirty workaround for MediaWiki or WordPress is to include

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

in the template files. This forces IE8 to run in compatibility mode. Google maps is using it too (as of March 30, 2009).

So, did Microsoft stop to support dynamically generated VML?

UPDATE: No, see below!