#1
  1. No Profile Picture
    sryder
    Guest
    Devshed Newbie (0 - 499 posts)
    Okay somebody out there must know how to do this. I have a script to open a new window, nothing overly difficult. But than I would like to open another one off the Flash File. If the user leaves the first open the new one goes in there and it does not use the proper variables to size the window. Is there a way to close a window from outside the window (by naming it or whatever) so that when I click on another link it opens a totally new one ? I have been told that there is a script that closes one window before opening another, anyone that can help me ?

    Thanks

    ------------------
    Shawn Ryder
    Multimedia Designer
    http://www.learningdesignstudios.com
  2. #2
  3. No Profile Picture
    mroberts
    Guest
    Devshed Newbie (0 - 499 posts)
    If I understand you correctly, you have a browser open, you click a link and want a new window to open, you then click another link to open a third window(including browser) then you want to close the second window. The problem you are having is that the page you want to come up in the third window is coming up in the second. If this is the case, when you open the third window, specify a different name as you thought. To close the second window that called the third window, use the following:

    <head>
    <script language="JavaScript">
    window.opener.close();
    </script>
    </head>


    If this doesn't work, let me know.

    mroberts@naxs.com
  4. #3
  5. No Profile Picture
    sryder
    Guest
    Devshed Newbie (0 - 499 posts)
    Thanks for the help, but I am a little confused. Does the code go in the HEAD of the original browser window or in the second one ? and if it goes in the first how do you call on the function ?

    ------------------
    Shawn Ryder
    Multimedia Designer
    http://www.learningdesignstudios.com
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    Bristol, VA USA
    Posts
    6
    Rep Power
    0
    You can't close the window that is going to open the new window because it will never process the code to open the new window. You can try two things: First you can open the new window, then at the end of your program do a window.close or self.close (this code will go in the window that you want to close) or you can open the new window and the first piece of code that will be processed is the code that I sent earlier. Just remember that the computer processes code from the top going down. You have to open the new window before you can close the window that is calling the new window.

    If you do it the first way: call your function to open the new window, then the last piece of code in your program, do a window.close() or self.close() ... you can do this right before your end </body> tag(put in the <script language="JavaScript">window.close() or self.close()</script>.

    If you do it the second way: open the new window as you normally would (name it differently), then put the code snippet that I sent you in the head of the most recently opened window. (the last one opened) That way, the first thing that will happen in the newest window will be to close the window that called the newest window.

Similar Threads

  1. URL with bookmark on close spawns multiple pop up windows
    By Lalita in forum Beginner Programming
    Replies: 4
    Last Post: February 3rd, 2004, 11:11 PM
  2. .NET vs. Windows API programming
    By anatol in forum .Net Development
    Replies: 5
    Last Post: January 23rd, 2004, 11:23 AM
  3. Windows 2000 neverending Pop Ups
    By LinkinParkFan84 in forum Windows Help
    Replies: 11
    Last Post: September 26th, 2003, 10:11 AM
  4. Need Help Networking A Desktop and Labtop
    By grkgqmodel in forum Networking Help
    Replies: 1
    Last Post: June 20th, 2003, 03:55 PM
  5. using pop up windows and target
    By bakedbean in forum HTML Programming
    Replies: 5
    Last Post: October 30th, 2002, 12:58 PM

IMN logo majestic logo threadwatch logo seochat tools logo