Nathan R
Nathan R

Reputation: 870

Trying to close a popup and reload its parent page

Here's my code:

function reloadParentAndClose() {
    window.opener.location.reload();
    window.close();
}

And here's the error I get:

32:132 Uncaught TypeError: Cannot read property 'location' of null(…)

Any ideas what might be happening?

Upvotes: 0

Views: 619

Answers (1)

holtc
holtc

Reputation: 1820

It means that window.opener is null, and therefore trying to access the location property is invalid, since window.opener is null and therefore there is no such thing as window.opener.location

Upvotes: 1

Related Questions