Jinxed
Jinxed

Reputation: 736

close parent window on load of child window

I have a pop up window which has a button. onclick of the button I open another window using window.open(url). I want to close the parent window in onload event of the child event.

I tried window.opener.close(). But it was not of any help. I open the child window using the following code in the parent window

$(function () {
    $('#testpopup').click(function () {
         window.open('complete.aspx');
    });
});

Upvotes: 0

Views: 1126

Answers (2)

PSR
PSR

Reputation: 40318

Ttry this

var w = window.opener;
    window.opener = self;
    w.close();

Upvotes: 0

Heejin
Heejin

Reputation: 4571

Try this:

parent.window.opener.close()

Upvotes: 1

Related Questions