javascript - JS - file onload() doesn't work with android browser -
i have application similar example http://jsfiddle.net/jonathansampson/k3a9r/ if use concept file upload on ipad/android not work. image not loaded browser wether onload() nor onloadend()
html:
<input type="file" name="myfileselect" />
js:
// bind change event of our file input $("input[name='myfileselect']").on("change", function(){ // reference filelist var files = !!this.files ? this.files : []; // if no files selected, or no filereader support, return if ( !files.length || !window.filereader ) return; // proceed if selected file image if ( /^image/.test( files[0].type ) ) { // create new instance of filereader var reader = new filereader(); // read local file dataurl reader.readasdataurl( files[0] ); // when loaded, set image data background of page reader.onloadend = function(){ $("html").css("background-image", "url(" + this.result + ")"); } } });
i don't believe onloadend event supported in android or ios. ie 10 not support event on filereader well, think. perhaps should rely on onload event instead.
Comments
Post a Comment