Monthly Archives: December 2008

Detect if ExCanvas is loaded

When using ExplorerCanvas (excanvas) to emulate the Canvas object in Internet Explorer it might be a good idea to check that the excanvas lib really is loaded before trying to create a context object. If not, an informative error message may be displayed instead of some cryptic “object doesn’t support this property”.

Here is a way to check if excanvas.js has been loaded.

if (typeof window.CanvasRenderingContext2D == 'undefined' &&
    typeof G_vmlCanvasManager == 'undefined') {
        alert("ExCanvas not loaded!");