Close a page from a popup with JavaScript


I am making a web application and from a page I open a pop-up. From that pop-up it opens another page and I want the previous one to close. I have already tried with self.close() and with window.close() but I am unable to close the page from the pop-up.

Any suggestion?


To have access to the original window you have to use the window.opener property ( here you have the documentation)

And this is the code with which you would close it:

Scroll to Top