各位前輩大家好,小弟剛開始寫web ui,如題,最近實做帶有進度條的下載功能,發現
XMLHttpRequest()物件若open超過1GB的file,在chrome上面就會crash
訊息: DevTools was disconnected from the page. Once page is reloaded, DevTool
will automatically connect.
我不是很明白為甚麼會這樣。
所以想請問板上各位大大是否有相關經驗可以為我解惑呢?
此外,我用這個方法也不曉得最後file會被下載到哪...這兩個問題是否相關呢?
感謝大家!
======================= 程式碼 ===========================
var client = new XMLHttpRequest();
var x = document.createElement("PROGRESS");
console.log('Entering TriggerProgressEvent');
client.open('GET',
'http://127.0.0.1:8080/features/upload/FileDownload.7z',true);
client.send();
client.onprogress = function(event) {
if(event.lengthComputable) {
console.log(event.total);
console.log(event.loaded);
x.setAttribute("max", event.total);
x.setAttribute("value", event.loaded);
document.body.appendChild(x);
}
};
======================== 結束 ================================