如何使用 jQuery 重新加载我的子窗口的父窗口?
No jQuery is necessary in this situation.
window.opener.location.reload(false);
You can use window.opener , window.parent , or window.top to reference the window in question. From there, you just call the reload
method (eg: window.parent.location.reload()
).
However, as a caveat, you might have problems with window.opener
if you need to navigate away from the originally opened page since the reference will be lost.
parent.location.reload();
这应该有效。
if you want to simply reload the parent window of child window: This line code below is enough for that.
opener.location.reload();
if you want to reload parent window with query string (request) with old or new values. Following code will do the work.
if (opener.location.href.indexOf('?') > 0) {
var baseUrl = opener.location.href.substring(0, opener.location.href.indexOf('?'));
opener.location.href = baseUrl + "?param1=abc¶m2=123";
}
else {
opener.location.href = opener.location.href + "?param1=abc¶m2=123";
}
this opener.location.reload();
is not required in above example.
您可以使用以下方法重新加载父窗口位置:
window.opener.location.href = window.opener.location.href;
top.frames.location.reload(false);
This working for me:
window.opener.location.reload()
window.close();
In this case Current tab will close and parent tab will refresh.
Prevents previous data from been resubmitted. Tested in Firefox and Safari.
top.frames.location.href = top.frames.location.href;
window.parent.opener.location.reload();
为我工作。
This will work for refresh parent window from child window
window.opener.location.reload(true);
for some version of IE this will not work so you can set some delay
window.setTimeout(window.opener.location.reload(true), 3000);
这会起作用
window.location.assign(window.location.href);
For Atlassian Connect Apps, use AP.navigator.reload();
See details here
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.