0

I am writing a web application in java. When a user clicks on a link on my web page, I want that the file should be opened in default program of user. I dont want that file to be opened in browser.

till now, when i click link, the file downloads. here is my code :

<a href="file.txt" download>Click here to download</a>
Himanshu
  • 33
  • 6
  • opening or saving a particular file type is a setting of the browser that you cannot over-ride from JS. you can lie about the mime to force the open/save question on the user, if they have not chosen a preference about what to do with "all downloads". if you offer the files as "text/customized", most browsers will ask about how to handle the file, and almost all will offer to remember the app the user chooses to open it for next time, if that's that they decide to do. – dandavis Nov 21 '14 at 06:14
  • Possible duplicate of [Unable to open a text file in notepad via Javascript function](http://stackoverflow.com/questions/13110716/unable-to-open-a-text-file-in-notepad-via-javascript-function) – OO7 Nov 21 '14 at 06:19
  • I think, it is not possible to open a file in default program of user, from browser. It can open in new tab or in new pop-up window. – Nayana_Das Nov 21 '14 at 06:21
  • Duplicate of [How to force browser to download file?](https://stackoverflow.com/questions/6520231/how-to-force-browser-to-download-file) – Boann Nov 21 '14 at 06:46

0 Answers0