怎样中断父子窗口之间的联系

方法1. 在子窗口手动将window.opener设置为null

var newWin = window.open('example.html', 'newWindow', 'height=400,width=400');
newWin.opener = null;

方法2. 给 a 元素 添加 rel = "noopener" 属性, 可以防止新打开的窗口获取父窗口的全局属性和方法

<a href="https://an.evil.site" target="_blank" rel="noopener">
    恶意网站
</a>
原文地址:https://www.cnblogs.com/aisowe/p/11702801.html