Var link=document. The createElement method (' a ');
The link href=HTTP://https://bbs.csdn.net/topics/filePath;
The link. Download=fileName;
The link. The target='_blank';
Document. The body. The appendChild (link);
Link. Click ();
Code as above, chrome and firefox support on the PC, the cross-domain problem, you need to be mobile browser doesn't support a tag attributes of the download, how to set?
I am a direct access to the file server
CodePudding user response:
Oh, yeah, the name of the file on the server is not a real name, so I want to download by JS resetting the file name