Viz
Viz

Reputation: 21

Is there a JavaScript code to open the downloaded file from any browser?

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.

Upvotes: 1

Views: 2529

Answers (1)

Anant Dabhi
Anant Dabhi

Reputation: 11104

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).

Upvotes: 2

Related Questions