Forum Moderators: coopster

Message Too Old, No Replies

display text in the top of the browser window without <title>

for non html documents

         

alexis

11:57 pm on Feb 15, 2006 (gmt 0)

10+ Year Member



I use php to serve most of my documents using:

header('Content-type: application/pdf-or-rtf');
readfile($file);

For non html documents such as PDFs I would like to be able to show the title of the document in the top of the browser (the blue bar for most people). At the moment it shows application/pdf

I found that there are many possible header informations we can add to a document but none of them work

The ideal thing would be something like:
header("Title: ".$document_title);

but that does't work

Any idea?

alexis

11:59 pm on Feb 15, 2006 (gmt 0)

10+ Year Member



If there is a way to add a <title>my title</title> in the metadata of the PDF and somehow serve that with PHP in a way that would cause the title to appear in the top bar that would work... but I can't figure how to implement that.

StupidScript

12:16 am on Feb 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's a tough one, alright. It seems that each browser has its own way of handling non-HTML documents.

Most browsers launch the appropriate viewer for filetypes it is configured to handle. FF1.5.1 on Win98SE shows the page title, just as you'd expect, along with the MIME type, like

MySummerVacation.txt (text/plain)

when there is no viewer/Action specified for that type.

Of course, most browsers would open a PDF file in Acrobat ...

alexis

12:56 am on Feb 16, 2006 (gmt 0)

10+ Year Member



That's right. Just did some tests. Browsers do deal with non-HTML documents in their own twisted ways. I just loaded a swf in IE and Firefox

When I go View Source in Firefox I get the binary source of the swf.

But IE wraps the swf in an embed TAG in a dummy HTML document apparently generated on the fly.

IE also changes its menu when a PDF is loaded. quite inconsistant