Solved

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

Posted on 2003-11-25
11
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
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
 

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
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 …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

707 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