Tuesday, August 25, 2009

FusionCharts, IE6, and "Unknown runtime error"

FusionCharts' JavaScript file makes use of innerHTML to replace a placeholder <div>'s content with the generated SWF. However, on IE6, this causes an "Unknown runtime error".

I am working with version 1.2.4. I have jQuery 1.3 loaded on the site, so I replaced four instances of innerHTML calls with $().html() syntax:

Line 237:
{ n.innerHTML = obj.getSWFHTML(); },false );
became
{ $(n).html(obj.getSWFHTML()); }, false);

Line 242:
{ n.innerHTML = obj.getSWFHTML(); } );
became
{ $(n).html(obj.getSWFHTML()); });

Line 246:
n.innerHTML = this.getSWFHTML();
became
$(n).html(this.getSWFHTML());

Line 251:
n.innerHTML = this.getSWFHTML();
became
$(n).html(this.getSWFHTML());