javascript - Loading dynamically SVG into Canvas with FileReader in IE 11 leads to IndexSizeError -


i'm loading via filereader svg image canvas, works on browsers correctly, except of ie (11) raises indexsizeerror when calling canvas.drawimage because image seems not loaded, img.width , img.height zero.

other answers suggested use naturalheight/-width, doesn't work. here simplified code:

var file = $file.prop('files')[0],                               fr = new window.filereader();                                               if (file !== null) {                                                   fr.onload = function () {                                              var img = new image();                                              img.onload = function () {                                          loadimage(img);                                           };                                                                  img.src = fr.result;                         };                                                                 fr.readasdataurl(file);                                        }  

in loadimage error raised at:

... context.drawimage(img, 0, 0, img.width, img.height, 0, 0, width, height); ... 

any idea if ie supports or wrong.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

Kivy: Swiping (Carousel & ScreenManager) -

jdbc - Not able to establish database connection in eclipse -