Is there a JavaScript code to open the downloaded

2020-05-09 22:45发布

I have a JS code which should download a file and need to open that corresponding file. I'm able to download it but need a JavaScript code to open the recently downloaded file from any browser.

标签: javascript
1条回答
够拽才男人
2楼-- · 2020-05-09 23:29

Answer is No.

Why :

When user download file into his local file system then downloaded file became a part of users file and as you know you can't access any file/directory from users local file system.

Alternative solution :Yes

  1. Download file using XmlHttpRequest (AJAX) into blob object help link
  2. Open file from saved blob object.

in above alternative solution You can also allow use to save file(download file).

查看更多
登录 后发表回答