How does the front end know when the download is successful by pointing the URL to the download address?

  1. point to the download address through window.location.href to download the file. How to get the time after the download is successful?
Mar.29,2021

cannot get, browser internal event.


I can't help it. Haha. But you can use the cache!

1. Through ajax requests, it is possible to monitor progress.

after 2.ajax is successful, open window.location.href

axios({
    url: 'download'
}).then(() => {
    window.location.href = 'download';
});

window.location.href just opens the specified address and cannot be obtained. Meathill is right. It is an event within the browser.


there are a lot of ideas. However, it is not possible to


judge by the onprogress in the native XMLHttpRequest request
see here: how does js judge the progress of a file or picture download
https://codeshelper.com/q/10.


Hello. I have tried to write this and the download will fail. My download method is downloaded through the file server address of the file.

Menu