View a pdf instead of download chrome






















Asked 5 years, 10 months ago. Active 8 months ago. Viewed 27k times. Improve this question. AdarshMPallickal No I'm not using it — user AdarshMPallickal yup given and its working thanks a lot guys — user Show 1 more comment.

Active Oldest Votes. You need to change the Content-disposition to inline. Improve this answer. Pupil Pupil Add a comment.

Downloading or Opening of a PDF file depends on setting in the browser. Dharam Jindal Dharam Jindal 21 6 6 bronze badges. Alexander Alexander 43 1 1 silver badge 4 4 bronze badges. Kindly suggest me.

Thanks in advance. That does the opposite to what is asked for — Quentin. Nervous Laughter By default , when you open a pdf file in firefox, it will provide you with a popup to either save the pdf file or to open it directly and there is also a check box which says do this action automatically from now on and guess who selected it.

Ashfaq nisar Ashfaq nisar 6 6 silver badges 15 15 bronze badges. Nick Kongk. Open downloads. Cleb No mention that they use PHP. What if their backend is in Python or. He doesn't even say what framework he's talking about.

I have used this code and it worked perfectly. Mohsin Mohsin 5 2 2 bronze badges. No mention that they use Apache. What if they use IIS? Or Express? Gabriel Ryan Nahmias Gabriel Ryan Nahmias 2, 1 1 gold badge 24 24 silver badges 39 39 bronze badges. What if you don't use AdobeReader or don't use windows? You're answer will not work.

Moreover, it require asking the user to change their setting, which you can't do in real world. Kirk Strobeck Kirk Strobeck Yes, but I need a way to force to open in browser not to download. I have no idea if its possible.

If you aren't forcing it to download, then you ARE forcing it to open in the browser. If it won't open in the browser, it's because the user has specific setting, which you can't override or they don't have PDF reading software. This is wrong. The browser will download because it does not know this mime-type.

Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Who owns this outage? Building intelligent escalation chains for modern SRE. Podcast Who is building clouds for the independent developer? Featured on Meta. Now live: A fully responsive profile. Reducing the weight of our footer. There is a Chrome add-on that can override this behavior.

The following image is from the Firefox developer tools:. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Learn more. Why does Chrome sometimes download a PDF instead of opening it? Asked 3 years, 11 months ago. Active 3 years, 11 months ago. Viewed 71k times. Improve this question. Rgrthat Rgrthat 1, 2 2 gold badges 6 6 silver badges 10 10 bronze badges. Add a comment. Active Oldest Votes.

Content-Disposition That's usually because the site sends a Content-Disposition header in the response. Inline handling details When a Content-Disposition is inline or unspecified , the browser will try to open the file in the default embedded viewer. Type detection The file type can be specified by the server with a Content-Type header.

Type handling Upon receiving a file with an inline or unspecified disposition, the browser needs to try to open it within the browser if possible. A bit of a history lesson To see how PDFs are handled, we can delve a bit into web history. For example, the list of registered types for Flash: Those days were also before a lot of the media support that came with HTML5.

Improve this answer. Bob Bob The reason why the values "inline" and "attachment" are used is because Content-Disposition was originally specified for MIME email, where those values are a lot more appropriate : — hobbs.

Indeed - this logic overrides content disposition and is thus important to remember. LightnessRacesinOrbit It doesn't so much override the disposition as it gives the browser a type it can't do anything with barring sniffing other than save to disk.

Granted, the visible effect is the same.



0コメント

  • 1000 / 1000