Close child window, redirect parent window

I’ve got a page which opens a child window, from a parent.

After the user has done something in the child window, I need the child window to close, and its parent window to be redirected to a page, on the click of a button in the child window.

Any ideas?

from child:


The key is to use window.opener to access the parent window:

    window.opener.location = '/redirect.html';

try this:

var parent = window.opener;

parent.location ='some url';


here is an example in a fiddle:

Please try below :

  1. window.opener.location.reload(); will reload the parent window.
  2. close() will close the child window

It works fine for me.

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .
Read More:   How can I draw an image from the HTML5 File API on Canvas?

Similar Posts