首页 > Windows开发 > 详细

获取在父窗口“联系”用 window.open 打开的子窗口

时间:2021-09-11 13:17:02      阅读:32      评论:0      收藏:0      [点我收藏+]

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
  </head>
  <body>
    <button onclick="clickHandler()">打开窗口</button>
    <script>
      function clickHandler() {
        const targetWindow = window.open("./sub.html");
        targetWindow.leitang = 1;
        alert(targetWindow.opener === window);
      }
    </script>
  </body>
</html>

获取在父窗口“联系”用 window.open 打开的子窗口

原文:https://www.cnblogs.com/aisowe/p/15250129.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!