这是我的代码:
function reloadParentAndClose() {
window.opener.location.reload();
window.close();
}
这是我得到的错误:
32:132 Uncaught TypeError: Cannot read property 'location' of null(…)
有什么想法可能会发生什么吗?
最佳答案
这意味着window.opener为null,因此尝试访问location属性是无效的,因为window.opener为null,因此不存在window.opener.location这样的东西
关于javascript - 尝试关闭弹出窗口并重新加载其父页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40620716/