Home > front end >  Mobile browser javascript download file, a label the download file name, is invalid, how can I achie
Mobile browser javascript download file, a label the download file name, is invalid, how can I achie

Time:10-02

Var filePath=$(this). The parent (.), find (". FileDivPath "). The HTML ();
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
  • Related