Force chrome to open PDF instead of downloading
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How do I force files to open in the browser instead of downloading PDF?
Ask Question. Asked 10 years, 5 months ago. Active 5 months ago. Viewed k times. I tried using the embed tag and an iframe, but it only works when that option is checked. What can I do? Improve this question. Peter Mortensen Add a comment. Active Oldest Votes. Improve this answer.
Quentin k gold badges silver badges bronze badges. ColinM ColinM Taboada but then the user's system may not know the file type. Perhaps if you want to override the user's preferences then octet-stream would be the way to go, but giving the correct type and a suggested filename is the "correct" way to provide a download. So my question is should the content type be set before uploading? And also, we get only a link from the backend team, a url that gives the file path, that we open in new tab using:window.
Kailas I don't understand what you're trying to do.. These headers have no effect on a file upload, you need to have the code behind the url set the headers every time it is downloaded by the client.
ColinM Thanks buddy, you said it right, the issue when we debugged was the mime type was set while uploading the files. This should be done by the back-end team. I tried to get codes on how to add headers in java script but was not successful. Thanks, as I got the real idea cleared from you Show 5 more comments.
It uses the custom filename specified on the view side. Thanks for your support! Sergey Tkachenko is a software developer from Russia who started Winaero back in On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram , Twitter , and YouTube.
View all posts by Sergey Tkachenko. Your email address will not be published. Skip to content Advertisement. Support us Winaero greatly relies on your support. Very useful. Leave a Reply Cancel reply Your email address will not be published. Chrome has now made it so if you click on the document in the download history it will ONLY open inside the browser. There is no way to change this at the moment. You can still make it so the pdf automatically downloads instead of opening.
But when you try to open the download from Chrome all you get is Chrome. You have to instead Show the downloaded file in Finder Mac and open it from there. Why Google thinks this endears us to them is beyond me! In Version Your email address will not be published. Viewed 30k times. Improve this question. Dwayne Reid Dwayne Reid 1 1 gold badge 3 3 silver badges 12 12 bronze badges. I thought this would be easier but I was wrong. Turns out you can disable the internal viewer but you're trading it for opening in whatever app is registered to view PDFs.
I tried it and it worked for me, but only for this one session. If it doesn't work for you, try it again in incognito mode. Add a comment. Active Oldest Votes. Improve this answer. The issue may have to do with the way files are served by web servers. Community Bot 1.
Vinayak Vinayak Not working! As other answers here and other places, this leads them to be opened in external viewer Acrobat or Edge , regardless of Content-Disposition. There is no way to just download pdf-s like it is possible with other file types.
But the same thing happens with any gmail pdf attachment, when I click "download" arrow.
0コメント