New window.name value doesn't stick. Old value returns unless the window is refreshed

D

Diana

Hi there,

I'm having some difficulty in renaming a window object. I'm opening
the window in question via a targetted submit:

<!-- CODE EXCERPT FROM WINDOW 1 -->
<form target="newWin">

Based on certain criteria, I sometimes need to close window 1 and have
window 2 take its name:

<!-- CODE EXCERPT FROM WINDOW 2 (currently named "newWin" -->
var strWindowName = opener.name;
opener.name = null;
opener.close();
//Ensure the window doesn't hold onto the instance
opener = null;

//Rename the window
window.name = strWindowName;
top.name = strWindowName;

While an alert at the end of my function indicates that the renaming
has been successful, when I submit the form on window 2 I find that
the window name has reverted to "newWin". For some reason however,
refreshing the window makes the correct (previous opener) name stick.

I'm fairly baffled by this behavior, so any help would be so very
appreciated!

Thanks!

Diana
 
D

Diana

Just in case anyone else has this problem, after much experimentation
I was able to resolve my issue by revising the window.name value
immediately before submitting my form. This seemed to trick the form
into opening a new window rather than resubmitting into my existing,
newly renamed window.

What a headache. I'm guessing this is a bug with my version of IE or
with Javascript itself.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top