在 JavaScript 中是否可以通过 window.open() 确定窗口是否关闭? 以下是打开窗口的简单代码。
<script type="text/javascript">
var win = window.open("test.htm")
</script>
当某个事件被触发时。事件处理程序应该确定窗口仍然打开。
if ( /* is a window alive */ )
alert("window is still alive!");
else
alert("window was closed!");
最佳答案
This property indicates whether the referenced window is closed or not. [Read only].
关于javascript - javascript中通过window.open()判断窗口是否关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4551190/