By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,567 Members | 1,522 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,567 IT Pros & Developers. It's quick & easy.

title window.open()

P: n/a
In my web application I provide the user with a popup window to a rich
text document by calling window.open(). My problem is that the title of
the open window is something like
http://localhost:8080/app/images/232334.rtf. Is it possible to set this
title to something different. As Im loading what is basically a word
document instead of a html document I can't set it in the page.

Thanks
Clive
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
There is no title property/attribute for window. The Title actually
belong to document, so we can not modify the title on window.open().
If you want, you can modify the title using
onload="this.document.title='newtitle'"
on the new window.

(ref:phoenix398017)
Jul 23 '05 #2

P: n/a
If you really need to modify the title of document in new window, try the following:

<HTML>
<script>

var var_oTimer_Obj, var_oWinOpen_New;
function fun_mWinOpen()
{
var_oWinOpen_New = window.open('about:blank');
var_oTimer_Obj = window.setInterval("fun_mDoc_ReTitle('~~newTitle~~ ')", 10);
}

function fun_mDoc_ReTitle(prm_sDoc_NewTitle)
{ if (var_oWinOpen_New.document.readyState == 'complete')
{ var_oWinOpen_New.document.title=prm_sDoc_NewTitle;
window.clearInterval(var_oTimer_Obj);
}
}

</script>
<input type=button value="open window" onclick="fun_mWinOpen()"></input>
</HTML>

(ref:phoenix398017)
Jul 23 '05 #3

P: n/a
Lee
Clive Moore said:

In my web application I provide the user with a popup window to a rich
text document by calling window.open(). My problem is that the title of
the open window is something like
http://localhost:8080/app/images/232334.rtf. Is it possible to set this
title to something different. As Im loading what is basically a word
document instead of a html document I can't set it in the page.


Depending on the browser in use and how it's configured, there's
a very good chance that the document won't open in a browser window
at all, but in a separate Word application window.

However, in those situations where it will open in a browser window,
you should be able to use this code, to open it in a frame of a new
window whose title you can set:
function showDoc(URL){
globalHTML="<html><head><title>Something Different</title></head>"
+"<frameset rows='100%,*'><frame src='"+URL+"'></frame>"
+"</frameset></html>";
window.open("javascript:opener.globalHTML","myPOPU P");
}

Jul 23 '05 #4

P: n/a
Lee
i-Safire said:

If you really need to modify the title of document in new window, try the
following:

<HTML>
<script>

var var_oTimer_Obj, var_oWinOpen_New;
function fun_mWinOpen()
{
var_oWinOpen_New = window.open('about:blank');
var_oTimer_Obj = window.setInterval("fun_mDoc_ReTitle('~~newTitle~~ ')", 10);
}

function fun_mDoc_ReTitle(prm_sDoc_NewTitle)
{ if (var_oWinOpen_New.document.readyState == 'complete')
{ var_oWinOpen_New.document.title=prm_sDoc_NewTitle;
window.clearInterval(var_oTimer_Obj);
}
}

</script>
<input type=button value="open window" onclick="fun_mWinOpen()"></input>
</HTML>


No offense meant, but I would really hate to have to read
much code using that naming convention.

It leaves no doubt about what every identifier is, but at
the cost of destroying the readability of the code.

If the code is written well, and meaningful names chosen
and appropriately documented, I shouldn't ever have any
question about the identifiers, anyway.

For example, if you name your functions "openNewWindow()"
and "retitleDocument()", the simple fact that they are verbs
tells the reader that they are functions.

Jul 23 '05 #5

P: n/a
Thanks for your reply Lee

Your tip works ok apart from the fact that the word menus within ie are
no longer available. For example i am unable to forward the rtf
document as
an e-mail.

Any other ideas?

Thanks
Clive
Clive Moore said:

function showDoc(URL){
globalHTML="<html><head><title>Something Different</title></head>"
+"<frameset rows='100%,*'><frame src='"+URL+"'></frame>"
+"</frameset></html>";
window.open("javascript:opener.globalHTML","myPOPU P");
}



--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.