How JavaScript uses the downloadFile function
Editor to share with you how JavaScript uses the downloadFile function, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
DownloadFile:base64 data export file, file download
Function downloadFile (filename, data) {let DownloadLink = document.createElement ('a'); if (DownloadLink) {document.body.appendChild (DownloadLink); DownloadLink.style = 'display: none'; DownloadLink.download = filename; DownloadLink.href = data; if (document.createEvent) {let DownloadEvt = document.createEvent (' MouseEvents'); DownloadEvt.initEvent ('click', true, false) DownloadLink.dispatchEvent (DownloadEvt);} else if (document.createEventObject) {DownloadLink.fireEvent ('onclick');} else if (typeof DownloadLink.onclick = =' function') {DownloadLink.onclick ();} document.body.removeChild (DownloadLink);}} this is all about the article "how JavaScript uses downloadFile functions". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!