Load New Page In Parent / Close Popup Window

Posted on 2001-07-10
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) {

with the following link:

<A HREF="javascript:OpenInMain('')" 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?
Question by:lhutton
  • 2
LVL 15

Accepted Solution

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

  function OpenInMain(mainurl) {

and change the link to:

<A HREF="javascript: OpenInMain('');">New Site</A>



Author Comment

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

Cheers :)
LVL 15

Expert Comment

ID: 6272082
Glad to help. :o)


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
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…

864 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now