Downloading Instead Of Showing Image Or Video File
I am hosting a simple html file on localhost, I want to force google chrome browser to download file instead of opening it. For the same I've used download attribute in anchor tag
Solution 1:
Did you try setting these headers in the response:
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=file.ext");
If you really haven't created any kind of servlet/controller to receive the request you might need to configure a filter: http://tomcat.apache.org/tomcat-8.0-doc/config/filter.html
You can find a lot of information here too: Set CORS header in Tomcat
Post a Comment for "Downloading Instead Of Showing Image Or Video File"