<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <script>
    window.addEventListener("pageshow", ({ persisted }) => {
      let bc = new BroadcastChannel("form_restoration");
      bc.addEventListener("message", ({ data }) => {
        switch (data) {
          case "enter_data":
            document.getElementById("formElement").value = "test";
            break;
          case "reload":
            bc.close();
            location.reload();
            break;
          case "navigate":
            bc.close();
            document.location = "file_form_restoration_no_store.html?1";
            break;
          case "back":
            bc.close();
            history.back();
            break;
          case "close":
            bc.close();
            window.close();
            break;
        }
      });
      bc.postMessage({ persisted, formData: document.getElementById("formElement").value });
    });
  </script>
</head>
<body>
  <input id="formElement" type="text" value="initial">
</body>
</html>
