I have two pages called as "Form_1.html" and "Form_2.html".
"Form_1.html" is the parent window from which i am opening "Form_2.html" using window.open() method.
Now what i want is that when i write window.close() in the child window("Form_2.html") i want the focus to return back to "Form_1.html" and the parent window should get refreshed.
I want it in javascript only because i cannot use jquery(because it is not allowed).
Thank you in advance
You can use this :
function RefreshParent() {
if (window.opener != null && !window.opener.closed) {
window.opener.location.reload();
}
}
window.onbeforeunload = RefreshParent;
You can find a demo here : http://aspsnippets.com/demos/542/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.