假设我有父页面。
当我单击“打印”时,会打开一个新选项卡(页面)以进行打印预览。
我想要的是,当我单击“打印”时,父选项卡(页面)上应显示覆盖层,以停止进一步的工作,直到子选项卡关闭。
Because when print tab (page) (child) is opened, most of the functions on parent tab (page) are not working properly.
注意:我正在使用 Google 默认打印/预览功能。
我无法编写代码来执行上述场景。如何在父页面中检测到其子页面已关闭?
最佳答案
您可以在 jQuery 中使用dialog
follow this link to view或者您可以在代码中使用,例如
var childNode= window.open('/uri of child');
然后使用
childNode.onunload = function(){
// code after child closed
}
如果没有的话你也可以尝试
window.onunload = function() {if(!window.opener.closed && childNode.closed){
//code after child closed
}}
关于javascript - 在父选项卡(页面)上显示叠加层,直到打开其所有子选项卡(页面),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32986801/