I have the following javascript code that runs when a page is closed.
$(window).unload(function () {
window.opener.location.reload();
});
Is there a way to pass a paramenter to the page that calls this closed page ?
If you want to close popup and reload parent page, You should use this.
window.opener.location.href='/pageurl.html?id=1'
window.close();
The javascript variable window.parent should let you access to any parameters of the parent of the popup.
window.parent.reload();
from inside the popup should work.
As for the parameter
window.parent.variableName = 'Hello World!';
will create a variable name variableName in your parent.
So inside the parent, you will be able to do
alert(variableName);
and have an alert with the content 'Hello World!';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With