<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>页面1</title>
</head>
<body>
  <input type="text" id="input">
  <button id="send-btn">发送信息</button>
  <iframe src="page2.html" frameborder="0"></iframe>
  <script>
  // https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
  // 能发postMessage的前提是，两个页面 同协议，端口号和host(document.domain)
    var popup = window.open('page2.html')
    var iframe = window.frames[0]
    var input = doc