Google-chrome – Force file link to open as a preview in [new] tab (instead of downloading)

file-downloadgoogle-chromeimages

Sometimes you want to follow a pdf/image/etc link and actually see it in the browser instead of downloading it.
In my most recent run-in it was with a screenshot on a Mantis server I'm using.

When I click to follow the link it immediately prompts me to save the file, with no option to open it the browser.
I really don't want to download it, open it in an image viewer, then remember to delete the file when I'm done. I'd like that to be handled by the browser when I close the tab for normal images/pdfs like when you click open [image] in new tab.

I know why the browser is doing it, the content is being served with the HTTP header Content-Disposition:attachment, but I'm sure that there would be an advanced setting, hidden context menu option, or awesome extension that would let you view something that somebody wanted you to actually save.

Does anyone know anything like that?


EDIT

Seems Firefox has an add-on for it, but I can't find a port for Chrome.

Best Answer

Who defines whether the file will be downloaded or opened is the site developer. Naturally the file is opened in the browser, but if the developer force the HTML header below, will always be downloaded.

There is no way to force. :(

Response.AddHeader("Content-Disposition", "attachment; filename=fileToForceDownload.pdf");
Response.AddHeader("Content-Length", 12345);
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(bytesOfFile);

To open in browser, developer must declare:

Response.AddHeader("Content-Disposition", "inline; filename=fileToOpen.pdf");
Response.ContentType = "application/pdf";

The above was written in C# but its parameters are common to any language sites

Related Question