Tengo un botón donde puedes cargar una imagen e insertarla en una etiqueta, funciona en todos los navegadores pero no en Chrome. Se procesa el primer reader.onloadend , puedo registrar image e image.src .
var inputUpload = document.getElementById('buttonUpload'); inputUpload.addEventListener('change', (e) => { const file = e.target.files[0]; const reader = new FileReader(); reader.onloadend = () => { //Initiate the JavaScript Image object. var image = new Image(); image.src = reader.result; console.log('image.src'); image.onloadend = function() { /* execution stops here */ var height = this.height; var width = this.width; if (height > 150 || width > 150) { showAlert('Image dimensions must be within 150×150 pixels.'); } else { // convert file to base64 String const base64String = reader.result.replace('data:', '').replace(/^.+,/, ''); // display image valueImg = "data:image/png;base64," + base64String; updateImg(valueImg); }; }; }; reader.readAsDataURL(file); }); <button id="buttonUpload" type="button" class="d-inline btn-custom mx-0"> Upload </button>Cuando selecciono el archivo de imagen, se detiene en image.loadend pero no aparece ningún error en la consola.