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

Discussion in 'Javascript' started by Diana, Apr 3, 2004.

  1. Diana

    Diana Guest

    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
    Diana, Apr 3, 2004
    #1
    1. Advertising

  2. Diana

    Diana Guest

    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.
    Diana, Apr 6, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. A. Ashby via DotNetMonster.com

    Old Proxy IP Used By .NET Client Unless Forced by Machine.config

    A. Ashby via DotNetMonster.com, Apr 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    789
    Scott Allen
    Apr 9, 2005
  2. bussiere maillist
    Replies:
    0
    Views:
    475
    bussiere maillist
    Dec 7, 2007
  3. Tim Chase
    Replies:
    0
    Views:
    566
    Tim Chase
    Dec 7, 2007
  4. Antonio O''Neal

    user.identity.name returns old AD user name

    Antonio O''Neal, Oct 31, 2008, in forum: ASP .Net Security
    Replies:
    5
    Views:
    2,037
    Antonio O''Neal
    Nov 3, 2008
  5. Gábor SEBESTYÉN

    Unless unless

    Gábor SEBESTYÉN, Jun 17, 2005, in forum: Ruby
    Replies:
    3
    Views:
    139
    Gábor SEBESTYÉN
    Jun 17, 2005
Loading...

Share This Page