[英]Close pop-up then go to a URL in the parent
我打開了一個彈出窗口:
window.open(url, 'mySurvey', 'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,dependent,width=1000, height=800,left=50,top=50');
當該窗口打開時,用戶可以單擊將關閉窗口的鏈接,然后重定向到父窗口中的頁面。
我熟悉window.close()
並且工作正常。 我不確定如何使用相同的單擊操作在父窗口中獲得重定向操作。
您可以使用window.opener
或window.parent
訪問打開彈出窗口的窗口。 您可以在關閉彈出窗口之前在點擊事件中使用它:
function myClickEvent(){
window.opener.location.href = "the_new_url.htm";
//or window.parent.location.href = "the_new_url.htm";
window.close();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.