确定新窗口何时关闭



在我的控制器中.js我打开了一个带有window.open();的新窗口

我需要开始加载符号,并在用window.open();关闭打开的窗口后,我需要停止加载符号。 是 possible.my 示例代码如下。

$scope.showAuditLoadingDiv = true;
window.open("newPage", "_BLANK", "location=yes,height=570,width=520,scrollbars=yes,status=yes");
$scope.showAuditLoadingDiv = false;

window.open()返回一个窗口对象...您可以检查它的"关闭"属性。示例代码:

var google = window.open("https://www.google.de/");
console.log(google);
setInterval(function () {
console.log(google.closed);
}, 300);

关闭新窗口时,关闭属性设置为 true。

最新更新