One of my actions with the controller returns the file to the user. I would like the user to be presented with the download (open / save) dialog box, regardless of file type. This works fine when the file type is .doc, .docx, .xlsx, etc., but when the file is .txt, .xps, .pdf (sometimes) or .html, it opens in a browser.
Is there a way to prevent the file from opening in the browser and allow the user to open it in a separate window without going from the current page?
A file request is created using jQuery $.ajax({}).
Related: if the browser processes the request and displays a pop-up window, unlike an AJAX call that receives a file connection as an answer string, this is explained by this ansher , but this question is about how to make the browser process the file in a certain way after receiving it.
source
share