javascript - Progressbar for a XMLHttpRequest file download -
firstly sorry if potential duplicate issue.
i trying display file download status , display in dialog box using xmlhttprequest. far able achieve in displaying download status in dialog once file downloaded. file not created stored in browser memory. able see file downloaded in response of request.
can please me how can show progress without overwriting file download behavior.
you want tracking xmlhttprequest's progress event can use update dialog:
xhr.addeventlistener("progress", function(event) { if (event.lengthcomputable) { var percentloaded = (event.loaded / event.total) * 100; console.log(percentloaded); } });
(one caveat: while supported in modern browsers not supported below ie10.)
Comments
Post a Comment