Make a File Open in Browser Instead of Downloading It

View pdf file in browser instead of downloading

You need to change the Content-disposition to inline.

Change

header("Content-disposition: attachment;     
filename=".basename('theme/assets/pdf/ci.pdf'));

To:

header("Content-disposition: inline;     
filename=".basename('theme/assets/pdf/ci.pdf'));

Opening files in browser instead of downloading

add target="_blank" to get a new window. adding .pdf may help. If you have control over the host web server adjusting the headers for the files in question will also help it open inline. I can tell you what headers to set if you are able too

Open Files in Browser instead of downloading (including files like .doc, .xls etc)

As far as I know, there are no client-side libraries exist that can open .doc, .docs, .xls in browser. There is a way to render render your files using browser is to use Google Documents' Viewer or Microsoft Office 365 viewer via an <iframe>. Using this inside an <iframe> you can open your file in side your browser but can not edit.

Google Documents' Viewer inside <iframe>

<iframe src="http://docs.google.com/gview?url=http://example.com/path/to/your/document.doc&embedded=true"></iframe>

Google Documents' Viewer clickable link <a>

<a href="http://docs.google.com/gview?url=http://example.com/path/to/your/document.doc&embedded=true">Open your doc file</a>

Microsoft Office 365 viewer <iframe>

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=http://example.com/path/to/your/document.doc' width='1366px' height='623px' frameborder='0'></iframe>

How to force open links in Chrome not download them?

To make certain file types OPEN on your computer, instead of Chrome Downloading...

You have to download the file type once, then right after that download, look at the status bar at the bottom of the browser. Click the arrow next to that file and choose "always open files of this type". DONE.

Now the file type will always OPEN using your default program.

To reset this feature, go to Settings / Advance Settings and under the "Download.." section, there's a button to reset 'all' Auto Downloads

Hope this helps.. :-)

Visual Instructions found here:

http://www.presentermedia.com/blog/2013/10/my-file-automatically-opens-instead-of-saving-with-chrome/

Controller opens file in the browser instead of downloading it

Removing response.flushBuffer(); has fixed my issue.



Related Topics



Leave a reply



Submit