Solved

Cannot set title for window.open for MS IE 7

Posted on 2007-03-24
10
1,672 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dynamic Dropdowns 15 33
jQuery Scroll To Top 5 40
How can I alter this script restrict file types with a suffix of 4 charaters also? 3 29
Reactjs with .NET 3 39
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…

820 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