Solved

Cannot set title for window.open for MS IE 7

Posted on 2007-03-24
10
1,670 Views
Last Modified: 2007-11-27
Hi,

I would like to set a title (e.g. MY TITLE) that will appear on top of MS Explore 7 window.  I open this window from a parent window.  I tried the following, but they seem to not work:
In my JavaScript:

1.     wRef = window.open(url, 'MY TITLE',    
"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=850,height=700");

2.       wRef.document.title = "MY TITLE";

3.     document.title = "MY TITLE";
0
Comment
Question by:akoifman
  • 4
  • 4
10 Comments
 
LVL 10

Expert Comment

by:Jaax
ID: 18787308
In window.open(url, "MY TITLE", ...) , the argument for which you set the value as "MY TITLE" is actually the Window Name.
To set the title, in the HTML page you need to specify it inside  the <TITLE></TITLE>
0
 

Author Comment

by:akoifman
ID: 18787316
I need the window name to be set dynamically from the parent window (parent knows the name).
0
 
LVL 10

Accepted Solution

by:
Jaax earned 250 total points
ID: 18787370
winHan = window.open()
winHan.document.title="My Title" works in IE 6 but not in FF. Is your popped-up page JSP/ASP or just a static HTML. If it is an dynamically generated page like JSP/ASP, then you would pass title as a parameter to the popped-up window.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:akoifman
ID: 18788121
Hi Jaax,

I used JSP:

in MS IE & I see window name:
http://lab13-20.ibrix.com:8080/index2.jsp?TITLE=MY TITLE

It looks fine in XP's Taskbar and FF on LINUX.  What is this extra stuff in window's name: http://lab13-20.ibrix.com:8080/index2.jsp?

This is the code: <title> "<%= request.getParameter("TITLE")%>" </title>

DId I have to add any other tags (I am not very familiar with JSP)?
0
 

Author Comment

by:akoifman
ID: 18788292
Hi Jaax,

I think I looked at the wrong place.  The JSP code does set the window title.  I was just looking at the link just below it.

Thanks.
0
 
LVL 10

Expert Comment

by:Jaax
ID: 18790860
If your pop-up is in fact a JSP page, then your problem is already solved.

Also please use encodeURI to encode your URL which uses spaces
encURl = encodeURI("http://lab13-20.ibrix.com:8080/index2.jsp?TITLE=MY TITLE");


0
 

Author Comment

by:akoifman
ID: 18792347
It seemed to work without encodeURI.  After I use encodeURI isee the "ugly" % symbols in the path.  When do I really need it?  

Thanks.
0
 
LVL 10

Expert Comment

by:Jaax
ID: 18792530
If it works without using encodeURI, then why bother ;)
I hope your problem is solved.

And just to complete of what was mentioned previously in my post
>Also please use encodeURI to encode your URL which uses spaces
>encURl = encodeURI("http://lab13-20.ibrix.com:8080/index2.jsp?TITLE=MY TITLE");

At the JSP end, the encoding has to be complemented by decoding
As
<title><%= URLDecoder.decode(request.getParameter("TITLE"),"UTF-8")%></title>

In your page directive append the following package
<%@page import=" ....,java.net.URLDecoder" %>
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

773 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