I use html5 to create drag and drop features. This works fine for me in firefox, but in chrome the onload event of the image only fires for the first time. If I drag several images only in the first works, and if I drag the second one, then it fails. I believe the problem is with the image loading.
this is how my code works, I deleted the unnecessary sections:
var img = document.createElement("img"); var reader = new FileReader(); var canvas = document.createElement("canvas"); var canvasData; var ctx = canvas.getContext("2d"); var myFiles; var i = 0; reader.onload = (function (aImg) { return function (e) { aImg.src = e.target.result; }; })(img); img.onload = function (){
Does anyone know why this works in firefox but not in chrome?
source share