@TOCgoogle关闭子页面弹框
google关闭子页面弹框
问题
用的google调试项目,用了以下几种方法都不行。
1、
window.close();
必须是使用window.open打开的窗体才可以使用window.opener=null;window.close();无提示关闭窗体。
2、
open(location, '_self').close();
3、
window.open('','_self','');
window.close();
4、
window.location.href="about:blank";
window.close();
解决
父页面
$('#updateDialogOpenLink').iframeDialog({
id : "fUserAddDialogOpenLink",
bgiframe: false,
resizable: true,
width:"980",
height:"620",
modal: true,
dialogClass: "no-titlebar",
close: function(event, ui) {
$(this).remove();
}
});
$("#pop").click(function () {
var url = "";// 子页面url
$("#updateDialogOpenLink").attr("href",url).trigger("click");
})
<button type="button" id="pop">弹出</button>
<a id="updateDialogOpenLink" href="#"></a>
子页面
function close(){
$(parent.document).find('#closedailog').trigger('click');
}
<button type="button" onclick="close()">关闭</button>
closedailog是jquery.iframeDialog.js中的方法