Link to home
Start Free TrialLog in
Avatar of marc_rabil
marc_rabil

asked on

How to Set the Browser Title for non-HTML Document?

Is there are a way to set the browser title when putting a non-HTML document (e.g. a PDF or XML doc) in a browser?

The best I can tell, this was at one time possible with an HTTP header but is no longer supported.  I know I can do this by putting the non-HTML document in a frame and putting a title on the enclosing frameset, but this seems rather clunky.

Thanks in advance,

Marc
ASKER CERTIFIED SOLUTION
Avatar of seanpowell
seanpowell
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
we know framesets are clunky, but that's the only way to do it.

-gam3r
HI
Can you be more explicit on what you want to do?
I mean, you have a PDF and want to show it on a new page, or just any pdf that could be found on the Internet through your page?
regards
Javier
>>we know framesets are clunky, but that's the only way to do it.
Actually, there's a number of ways to do it without framesets - one example is above...
Avatar of JakobA
JakobA

<!doctype
Avatar of marc_rabil

ASKER

jarasa:

We have a web application that puts various document types (eg. PDFs, XML, etc) in a new browser window. Everything works fine, except the new window title is the URL to the document and we want to make it a user friendly name like "Document Window".  The documents are usually not real files but are generated dynamically.  They are served up from our server so we have the opportunity to manipulate the response before the bytes are sent to the window.

Of course, we can first return HTML like a frameset (or an embed tag as suggested by georgemarian) which sets the title and in turns calls the document but I was hoping there was an easier way like to just set an HTTP header or something.

JakobA:

It looks like something is missing from your comment.

Marc
Hi Marc.

Try to find a javascript library called ByKlein_chromeless.js it will let you put the Title always no matter what you do and in iExplorer lets you cahnge almost all the GUI from the browser so you can even put a PDF icon or whatever. I said try to find it becose is not easy any more, the home page of this guy does not work any longer, if you're not able to find it let me Know and I'll send it to you some how, I know is not able to put emails here but maybe I'll be able to put it some where on the internet and give you the URL.

regards

Javier
Well at it's simplest level, "title" is a property of the object "document", so it can be easily accessed (except that it's read-only in NN4...)

One way would just be to modify the document title with some simple javascript, either in the head or the body section - although the former is probably preferable

<html>
<head>
<script language="javascript" type="text/javascript">
<!--
document.title = "My PDF Document";
//-->
</script>
</head>
<body>
PDF File outputs here...
</body>
</html>
Hi georgemarian.
I think that the problem of marc is that he does not control the output of the PDF becose is gerated dinamically, so he just sent the content to the outputStream and the browser opens it itself.
Javier
 
Hmmm...although he should still be able to control how the new window is generated, no? Or am I missing something...
Well if you open the new window with a title and call a servlet wich generates a pdf and opens you a download window when you say open it instead of save as file I think it changes the title and puts the temporal name of it.
I believe I had that problem but solved by unassinnig the PDF from the browser so it always opens the Acrobat and don't display it on the browser. but I think the javascript I said it does not change the title.
Javier