在A中 为window定义名称(因为默认是空),然后在B打开此名称的窗口。代码如下:
页面A代码
<script> window.name = '123' document.getElementById('test').addEventListener('click', function () { window.open('index2.html', 'mywindow'); }); document.getElementById('test2').addEventListener('click', function () { window.open('javascript:;', 'mywindow'); });</script>
页面B代码:
<script> document.getElementById('test').addEventListener('click', function () { window.open("javascript:;", window.opener.name); })</script>
联系客服