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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -