Solved

Cannot set title for window.open for MS IE 7

Posted on 2007-03-24
10
1,668 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
 

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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

746 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

13 Experts available now in Live!

Get 1:1 Help Now