title: HTML5 drag and drop folder detection in firefox. Is it even possible?
body: <p>I have a drop zone where I want to detect whether the dragged item is a folder or file. In chrome I achieved this by using</p>
  
  <pre><code>for (var i = 0; i &lt; nrOfFiles; i++) {
      var entry = e.originalEvent.dataTransfer.items[i].webkitGetAsEntry();
      if (entry.isDirectory) {
          //folder detection
  }
  </code></pre>
  
  <p>In firefox it is not possible to use the above solution(webkit) and after spending many hours trying to solve this I came up with the following solutions (and failed)</p>
  
  <ol>
  <li><p>I check whether the dragged item has no type and no size as below and in most cases it is working as expected. From what I've read this is not efficient and not successful all the times as some files may not have file extension so I try to read file as binary string(readAsBinaryString) or  readAsArrayBuffer with FileReader API and catch the exception in case the item is not readable but the exception is never thrown.</p>
  
  <pre><code>var files = e.originalEvent.dataTransfer.files;
  for (var i = 0; i &lt; nrOfFiles; i++) {
  if (files[i].size === 0 &amp;&amp; files[i].type==="") {
  
      try{
         var reader = new FileReader();
          reader.readAsBinaryString(files[i]);
      }catch(e){
          //folder detection ?
      }
  
  }}
  </code></pre></li>
  <li><p>In the following solution i am trying to use mozGetDataAt which is the corresponding webkitGetAsEntry (??? Not 100% about this please correct me if i am wrong) but i am getting a security exception.</p>
  
  <pre><code>var entry = e.originalEvent.dataTransfer.mozGetDataAt("application/x-moz-file",i);
  if (entry.isDirectory) { //not even reaching this statement. idk if isDirectory is applicable to entry
      //folder detection?
  }
  </code></pre></li>
  </ol>
  
  <p>And the exception is :</p>
  
  <blockquote>
    <p>Permission denied for <a href="http://localhost:8080" rel="nofollow noreferrer">http://localhost:8080</a> to create wrapper for object of class UnnamedClass</p>
  </blockquote>
  
  <p>Is there actually a way to do this in firefox? I do not want to rely on third party libraries or server side processing if possible. Any suggestions-comments would be much appreciated.</p>