0

Hello I am having a strange issue when running my site on ie11 when trying to use html2canvas where it throws a generic 'synax error' when the .then function is called. i have attempted to remedy this by using polyfill.min.js (from this link, i am using the CDN for simplicity's sake), but promises seem to still not be working. i was following instructions from RedStapler the youtube help channel (video).

does anyone know why this still isn't working, and have a solution? thanks!

html2canvas(document.getElementById("print"), {
    height: 990,
    width: 1760,
    logging:false
}).then(canvas => { //syntax error is thrown on this line
    document.getElementById('png-container').appendChild(canvas);
    $('#png-container > canvas').attr('id','thecanvas');  
    title = $('#title').text(); 
    exportCanvasAsPNG('thecanvas',title);
});
Andrelope
  • 103
  • 1
  • 11
  • 1
    Are you using babel? IE11 doesn't understand arrow functions. – alephtwo May 10 '18 at 14:10
  • 1
    It's nothing to do with promises, IE11 doesn't support arrow functions. Change your arrow function to a traditional function and it'll be fine (provided you have a promise polyfill in place, IE11 doesn't support promises, either). – T.J. Crowder May 10 '18 at 14:13
  • This turned out to be it, i used Babel to translate the code and it no longer threw the error. Thanks! – Andrelope May 10 '18 at 14:41

0 Answers0