I have seen a post before, it can be downloaded, but it cannot be downloaded on IE browser, but other browsers can
code show as below:
function download(src) {
var $a = document.createElement('a');
$a.setAttribute("href", src);
$a.setAttribute("download", "");
var evObj = document.createEvent('MouseEvents');
evObj.initMouseEvent( 'click', true, true, window, 0, 0, 0, 0, 0, false, false, true, false, 0, null);
$a.dispatchEvent(evObj);
};
Is there any way to achieve compatibility with IE and download pictures?
On IE, you can use window.open(src, name, '', true) to download.
I checked Baidu and found a solution. I made some modifications and tested that the download can run on IE, 360, and Google. I haven’t tried it on other browsers yet. I will do the following for now
The code is as follows: