CodePudding user response:
Var triggerEvent="touchstart";//specified download
The function saveAs (Url) {
Var blob=new blob ([...] and {type: 'application/octet stream -'});
Var url=url. CreateObjectURL (blob);
Var a=document. The createElement method (' a ');
A.h ref=https://bbs.csdn.net/topics/Url;
A. d. ownload Url=replace (/(. * \/) * ([^.] +. *)/ig, "$2"). The split ("?" ) [0];
Var e=document. CreateEvent (' MouseEvents');
E.i nitMouseEvent (' click ', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
A. d. ispatchEvent (e);
URL. RevokeObjectURL (URL);
}
Var imgs=document. GetElementsByTagName (" img ");
For (var I=0, o; O=imgs [I]; I++) {
O.a ddEventListener (triggerEvent, function () {
Var url=this. GetAttribute (" SRC ");
SaveAs (url);
},false);
}
CodePudding user response:
For help, click the download button, no download images, proposed separatelyCodePudding user response:
You have to solve?CodePudding user response: