[英]After closing popup window next page is opening in new tab
在我的代码中,我需要打开一个弹出窗口,其中将进行一些工作。 然后,从父页面开始,我将继续工作。 问题在于,每当我单击任意按钮时,关闭弹出窗口后,下一页就会在新选项卡中打开。 我在父页面中调用弹出窗口的代码如下:
document.auctionForm.action = "/getAcceptance.do";
popup = window.open('', 'view','top=0, left=350, height=500, width=600, toolbar=no, status=no');
document.auctionForm.target = 'view';
document.auctionForm.submit();
当我直接打开下一页而不打开弹出窗口时,不会发生此问题。 我尝试通过在弹出窗口关闭时刷新父页面来修复它,如下所示,但这每次都有效,并且必须手动刷新页面,这是不可接受的。
window.onunload = refreshParent;
function refreshParent() {
document.auctionForm.target = window.parent;
window.opener.location.reload();
}
我正在使用struts1。
我通过在提交后将目标更改回父窗口来解决它:
document.auctionForm.action = "/getAcceptance.do";
popup = window.open('', 'view','top=0, left=350, height=500, width=600, toolbar=no, status=no');
document.auctionForm.target = 'view';
document.auctionForm.submit();
document.auctionForm.target = "_parent";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.