473,404 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

title window.open()

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
5 23970
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: runes | last post by:
Hi, I'm trying to set the title of the console window (CMD.EXE) in Windows. I want it set to the basename of the current directory and it should stay after the script has finished. Now, the...
2
by: Paul Moffitt | last post by:
We have a Javascript function that opens an electronic document in a subwindow. The Title bar of the subwindow shows the filepath of the document. Looking at the script below is there any way to...
3
by: Luis | last post by:
Hello I'm opening a window with a SWF inside (no HTML, just the SWF) but in the title bar appears something like http://www.server.com/myDir/myWeb/Flash/myFlash.swf i'd like to write...
3
by: Russell | last post by:
I have a quirky issue that I believe involves timing and only 2 hairs left to pull. I have a modal dialog that is an IFrame. The IFrame contains another window - which contains the appropriate...
4
by: Daniel Morrissey | last post by:
Why will the following code not change the window title of the new window? window.open "Default.htm" ,"YO"
4
by: Benton | last post by:
Hi there, I have a child webform (with a ASP.NET calendar control) that opens in a javascript popup window when I click a button in the caller form. Child page has a <title> tag, and javascript...
9
by: Kavi | last post by:
in the pop up window, there is always a url before the title of the window, is there a way i can only have the title, and no url? i cannot give u a link to my page, but i have found an example...
4
by: Jon | last post by:
Hi, I am calling the function showpopupWindow(item) to open and write a popup window. When testing in IE6 locally the popup window displays my text in both the title and status bars but when...
2
by: prash.marne | last post by:
hi guys, i have simple problem with my pop up window my code is .... <html> <head> <script type="text/javascript> function open_window(){...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.