Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-11-30 19:14:40

hurty
Member
Registered: 2004-07-17
Posts: 28

PDF: Display in Browser vs. Download

The content type and disposition for PDF files seems to be hardcoded into the file_download component of Textpattern in such a way that user preference for how to deal with PDF files is ignored. (By “user” I mean the person viewing a website, not the person developing the Textpattern based site.)

Normally, in the wild, when I click on a PDF file, I can choose to have the file displayed in the browser window, or if I prefer, I can right click (or control click on a Mac) and choose to download the file. Textpattern only offers the option of downloading the file.

Any suggestions on how to change this behavior in Textpattern? I prefer not to hack around in publish.php because I hate having to redo this for several sites I manage whenever I upgrade. Is this something that could be accomplished using a plugin?

I understand that there are some file types that cannot be displayed readily and easily in a browser window, but for those that can, (PDFs, mp3s, etc.) could this be a site preference set in the administrative interface? I manage about half a dozen Textpattern sites, and a couple of my clients have specifically asked to be able to offer their reader’s a choice for how to deal with these types of files.

Offline

#2 2006-11-30 19:24:30

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: PDF: Display in Browser vs. Download

Isn’t this a browser setting? (In Firefox: Tools > Options > Downloads). When I click a download link in a Textpattern site of mine, I get the window that offers me the choice between open and save to disk.

Last edited by els (2006-11-30 19:26:22)

Offline

#3 2006-11-30 19:32:03

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: PDF: Display in Browser vs. Download

Normally, in the wild, when I click on a PDF file, I can choose to have the file displayed in the browser window

Yes, webservers do a lot of guessing and mimteype magic, with file-name endings and whatnot when serving static files. ou don’t get that whith php scripts. Textpattern core will eventually expand in that direction, in the meantime, you need to use (and more likely write) plugins to send different mim-types.

Offline

#4 2006-11-30 19:54:07

hurty
Member
Registered: 2004-07-17
Posts: 28

Re: PDF: Display in Browser vs. Download

Els wrote:

Isn’t this a browser setting? (In Firefox: Tools > Options > Downloads). When I click a download link in a Textpattern site of mine, I get the window that offers me the choice between open and save to disk.

That’s not exactly what I’m talking about. That option still exists. But “Open” means open in a PDF reader, not within the browser itself. Many users have installed browser plugins or set preferences to display PDF content within the browser window. But files delivered by Textpattern’s file_download module don’t respond properly to that user preference.

Offline

#5 2006-11-30 19:58:01

hurty
Member
Registered: 2004-07-17
Posts: 28

Re: PDF: Display in Browser vs. Download

Sencer wrote:

Textpattern core will eventually expand in that direction, in the meantime, you need to use (and more likely write) plugins to send different mim-types.

Any clues on when that kind of functionality would be built-in? 6 months, a year, longer…?

Offline

#6 2006-11-30 19:59:53

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: PDF: Display in Browser vs. Download

Ah I see. I understand that this could be preferred if you’d want to offer the pdf as content on your site, but opening it in the browser is not exactly what I would call ‘download’…

Offline

#7 2006-12-01 09:45:48

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: PDF: Display in Browser vs. Download

hurty wrote:

Normally, in the wild, when I click on a PDF file, I can choose to have the file displayed in the browser window, or if I prefer, I can right click (or control click on a Mac) and choose to download the file. Textpattern only offers the option of downloading the file.

You can do that now with txp.

Instead of using the link provided by the txp interface which looks something like yoursite.com/file_download/#" title="document.pdf" you can use yoursite.com/files/document.pdf. Note that at least on macs pdfs are not viewable on browsers unless you have a pdf browser plugin installed.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB