Gideon Isaac
Gideon Isaac

Reputation: 405

Is it possible to reload a page in a parent window using javascript from a child window?

I have an ASP.Net page with a table. The user can click on a button that opens a child window (using JavaScript), and in that new window, he is able to delete records from a database. The parent window should update a visible array of dots when he does that because those dots depend on the contents of the database.

So I tried assigning the parent window a name (with window.name="myParent" and then passing that via a query-string to the child window.

The child window would call myParent.location.reload(true) when it was finished with the deletions.

This does not seem to work unless I am missing some bug.

Should it work?

Upvotes: 0

Views: 291

Answers (1)

mdziekon
mdziekon

Reputation: 3627

You can try using window.opener as a reference to the parent window.

// inside parent.html
window.open('./child.html');

// inside child.html
window.opener.location.reload();

Upvotes: 1

Related Questions