使用 window.open 開啟新視窗後,可在新視窗中透過 window.opener 取得開啟它的上層視窗。
window.opener.location.reload(); alert("上層頁面已經刷新!");
若上層頁面已關閉或跨來源限制,可能無法存取 window.opener。實際使用時建議先判斷是否存在。