The world file link returned by the backend, how can the front end be downloaded locally?

The

backend now returns an address. You can download it by yourself if you open it directly in the browser, but how to download it with jsIE? What does the back end mean by using iframe?

Mar.20,2021

if the document is connected

add the following code to the callback function of the interface

var a = document.createElement('a');
a.href = url;
a.download = 'test.word';
a.click();

if you return a document, you can use fetch to receive and download

 fetch("/api", { credentials: 'include' }).then(x => x.blob()).then(x => {
            var a = document.createElement('a');
            var url = window.URL.createObjectURL(x);   //  blob  (blob )
            a.href = url;
            a.download = 'test.pdf';
            a.click();
            window.URL.revokeObjectURL(url);
        })

you can download the file through the src attribute in the iframe tag. Src is the url, returned to the front end by the background. It is written as follows:

               
function downloadFile(url) {   
        try{ 
            var elemIF = document.createElement("iframe");   
            elemIF.src = url;   
            elemIF.style.display = "none";   
            document.body.appendChild(elemIF);   
        }catch(e){ 
        } 
    }
<input type="button" value="1" onClick = "downloadFile('http://')">
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e47990-27185.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e47990-27185.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?