Solved

Load New Page In Parent / Close Popup Window

Posted on 2001-07-10
3
171 Views
Last Modified: 2008-02-26
I've added the following script to a popup window that's opened when a link in it's parent is clicked:

   function OpenInMain(mainurl) {
     window.opener.location=mainurl;
     return;
   }

with the following link:

<A HREF="javascript:OpenInMain('http://www.newsite.com/')" onClick="window.close();">New Site</A>

This loads a new page in the parent window, but it won't close the popup window. How can I do that at the same time?
0
Comment
Question by:lhutton
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
a.marsh earned 50 total points
ID: 6271268
Change the function to this:

  function OpenInMain(mainurl) {
    window.opener.location=mainurl;
    window.opener.focus();
    window.close();
    return;
  }

and change the link to:

<A HREF="javascript: OpenInMain('http://www.newsite.com/');">New Site</A>


:o)

Ant
0
 

Author Comment

by:lhutton
ID: 6271311
Ah! I tried window.close(); in the script but didn't even think of using window.opener.focus(); as well!

Cheers :)
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6272082
Glad to help. :o)

Ant
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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'…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

832 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