Computer >> Máy Tính >  >> Lập trình >> Javascript

Phát hiện các thư mục trong Safari với HTML5


Bạn có thể thử chạy mã sau để phát hiện các thư mục trong Safari -

Array.prototype.forEach.call(e.dataTransfer.files, function (file) {
   var r = new FileReader();
   r.onload = function (event) {
      addFile(file);
   };
   r.onerror = function (event) {
      alert("Uploading folders isn't supported in Safari browser!");
   }
   r.readAsDataURL(file);
});