html5 - Dragging a local file into textarea with Opera 12 -


i creating application using html5 able drag local text file textarea. works fine in firefox 20.0.1, chrome 26.0.1410.64 m , internet explorer 10 not in opera 12.15 or safari 5.1.7. instead of text of file appearing within text area new page opens containing text. understand this answer should expect problems safari implication should work opera 12.

any explaining or overcoming problem appreciated.

the application, near finished, @ grideasy.github.io source files @ https://github.com/grideasy/grideasy.github.io

to see effect click on 'content' button , drag text file text area.

both safari , opera pass detect feature code below

if(window.file && window.filereader && window.filelist && window.blob) {         dropzone = $('drop_zone');         dropzone.value="";         dropzone.addeventlistener('dragover', handledragover, false);         dropzone.addeventlistener('drop', handlefileselect, false);         dropzone.addeventlistener('click', storecursorposition, false);         dropzone.addeventlistener('keyup', storecursorposition, false);     }     else {      } 

this found in lines 30 41 of event.js file

the following code dropcontent.js reads file , displays text file.

function handledragover(evt) {      evt.stoppropagation();    evt.preventdefault(); }  function handlebodydrop(evt) {     evt.stoppropagation();     evt.preventdefault(); }  function handlefileselect(evt) {         evt.stoppropagation();     evt.preventdefault();      var files = evt.datatransfer.files; // filelist object.     var f = files[0];     if (f)      {         var r = new filereader();         r.onloadend = function(e) {extract(e.target.result) }         r.readastext(f);     }      else      {          alert("failed load file");      } }    function extract(a) {      $('drop_zone').value=a;  } 

thank suggestions

it appears opera not accept textarea object can used dropzone. changing textarea paragraph, span or div allow area accept draged , dropped file.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -