Solved

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

Posted on 2003-11-25
11
314 Views
Last Modified: 2012-08-13
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
0
Comment
Question by:marc_rabil
11 Comments
 
LVL 31

Accepted Solution

by:
seanpowell earned 125 total points
ID: 9818044
Here's one solution:

<html>
<head>
<title>My PDF File</title>
<style type="text/css">
<!--
body { margin:0px; padding:0px; overflow:hidden; }
//-->
</style>
</head>
<body>
<embed src="myfile.pdf" width="100%" height="100%">
</body>
</html>
0
 
LVL 7

Expert Comment

by:gam3r_3xtr3m3
ID: 9824023
we know framesets are clunky, but that's the only way to do it.

-gam3r
0
 
LVL 6

Expert Comment

by:jarasa
ID: 9824211
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
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9824233
>>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...
0
 
LVL 15

Expert Comment

by:JakobA
ID: 9829170
<!doctype
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:marc_rabil
ID: 9830794
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
0
 
LVL 6

Expert Comment

by:jarasa
ID: 9830835
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
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9830890
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>
0
 
LVL 6

Expert Comment

by:jarasa
ID: 9830908
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
 
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9830942
Hmmm...although he should still be able to control how the new window is generated, no? Or am I missing something...
0
 
LVL 6

Expert Comment

by:jarasa
ID: 9830997
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
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now