Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way of making Kinetic.js support IE8?

I am in a situation right now where I need to have some complex code working with Kinetic.js and a canvas element to work on IE8.

Officially, Kinetic.js has no plans of supporting IE8.

I tried using webshims lib but Kinetic.js fails on the following code:

Kinetic.Canvas = function(width, height) {
    this.element = document.createElement('canvas');
    this.context = this.element.getContext('2d'); //<-- Error here

    // set dimensions
    this.element.width = width;
    this.element.height = height;
};

The error is "Object doesn't support property or method 'getContext'". It makes sense to me, since I would not expect the element canvas created by an IE8 document to implement the methods for a canvas element, but if the <canvas> element was already created, webshims would have played and you could use the methods. However, forcing Kinetic.js to use one single canvas element will break some of its functionality (since it creates canvas objects on the fly).

Which are my options in order to achieve this?

like image 324
Alpha Avatar asked Oct 21 '22 21:10

Alpha


1 Answers

The simple answer is "no."

As one commentor mentioned, Google Chrome Frame is an OK substitute, which entails essentially installing Chrome's rendering engine as an IE plugin.

There's the excanvas project, which might sound good at first. It was an attempt to implement canvas in VML (SVG) so that IE 6-8 could use canvas.

Excanvas is awful. Especially with any animation, and it cannot do some canvas image manipulation stuff. And it hasn't been updated in almost 4 years. I highly suggest against using it, but it's there for your consideration.

like image 97
Simon Sarris Avatar answered Oct 24 '22 16:10

Simon Sarris