devxlogo

Pop-up Window with Links to New Pages

Pop-up Window with Links to New Pages

Question:
I want to set up a series of links in a pop-up window which, when clicked, will (a) close the popup window and (b) redirect the main page to the URL of the link. How do I do this? I know how to set up the pop-up and the close, but not the redirect of the main page to the link.

Answer:
Assuming that the main page is the one that opened the pop-up, the following code should work:

opener.document.location = newURL

where newURL is the URL of the location that you want the main page to load.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist