Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> JavaScript

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


Bạn có thể thử chạy mã sau để phát hiện 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("Tải thư mục không được hỗ trợ trên Safari!");    }    r.readAsDataURL(file); });