<script>
function f() {
  opener.postMessage("original", "*");
  document.write("<!doctype html>2<script>opener.postMessage('written', '*');<\/script>");
  document.close();
}

window.onload = f
</script>
