Linux html file keeps trying to download
Active 1 year, 10 months ago. Viewed 11k times. Thank you very much. Improve this question. Mostafa Tavakoli Mostafa Tavakoli 65 1 1 gold badge 1 1 silver badge 6 6 bronze badges.
Add a comment. Active Oldest Votes. Improve this answer. I actually stopped for a second to think if it could be Farsi, but found it statistically more probable to be Arabic Not a good method to recognize languages, I know, moreover with this approach I should have been guessing Chinese : Thanks for the correction though, it actually bothered me a little Sign up or log in Sign up using Google. What is this issue?
Where would you like to share this to? Twitter Reddit Hacker News Facebook. Share link Question share link. Sign Up. Yes, I'm sure. You previously marked this answer as accepted. Are you sure you want to unaccept it? DigitalOcean home. Community Control Panel. Hacktoberfest Contribute to Open Source. Why are snapshots so slow Question. Posted June 17, Add a comment. If it is blank, the browser defaults to the file's name.
Improve this answer. MultiplyByZer0 4, 3 3 gold badges 28 28 silver badges 46 46 bronze badges. Joe Pigott Joe Pigott 7, 5 5 gold badges 29 29 silver badges 42 42 bronze badges. Browsers that understand download treat it as a download, otherwise it's opened in a new tab. How can this be applied to a button object instead of just an a tag? Actually this only works for urls of the same origin as mentioned in the MDN docs. This is a huge limitation if we are looking to develop a generic solution — Akshat Gupta.
The question is explicitly asking to use a button instead of a link — Quentin. Show 9 more comments. Gray k 22 22 gold badges silver badges bronze badges. Cfreak Cfreak In when the answer was originally posted it wasn't supported in any major browser. This doesn't necessarily trigger a download.
It simply causes the browser to navigate to file. Whether that results in file. Show 3 more comments. Ani Menon What if i wanna download a xml file? Thanks for your code. I have tested, it can working in IE, Chrome, Firefox. If you have a file acceptable by the browser like a PDF it will open in new tab instead to show download dialog.
You could use window. Show 1 more comment. Stefanos Chrs Stefanos Chrs 1, 2 2 gold badges 14 14 silver badges 44 44 bronze badges. NicholasKyriakides Kind of reminds me of this gem: image. BryanLarsen You are right, Firefox doesn't allow this without adding the element to body first. Thank you, updating the answer — Stefanos Chrs. Is there a way that javascript function be triggered once the download finishes?
Just trying to show a message once downloads start and remove the message once download completes. This is best solution out here and should be accepted answer. Show 6 more comments. Mark Amery k 65 65 gold badges silver badges bronze badges. Matt Ball Matt Ball k 95 95 gold badges silver badges bronze badges. Perfect, thanks. Do you happen to know if most servers will set the Content-Disposition to 'attachment' by default?
There is no "most. This thread was archived. Please ask a new question if you need help. Ideally I'd like to be able to launch Firefox from my Linux command line and have it simply open an html file on my hard drive. I've tried a few variations but don't seem to be able to get around this. Does your shell allow you to right-click the file and open it in Firefox?
0コメント