Stop browser from downloading file if it can't be opened in browser
html, jquery
Solution
You cannot tell which capabilities the users browser has and what actions are linked to which filetype.
Simple example: The server does not know weather you have installed Microsoft Word and the server doesn't know either if your setting is "open in browser" or "always download this type of file". It would be a security problem if we can tell all this from the server. Because JavaScript is able to interact between client and server, it does also not know about all this.
Problem
I have this page where a list of many files are there like ``` a.jpg b.png c.php d.js e.pdf f.doc ``` They are all links and user can click on them and they are opened in a new tab. The problem is when a user clicks on JPG file it opens but when user clicks on DOC file instead of opening it prompts to download. How can i stop the download and open a blank page instead. Did a lot of searching but found nothing.