<!doctype html> | |
<meta charset=utf-8> | |
<body> | |
<script> | |
// Step 4 | |
let site2Window; | |
const listener = e => { | |
if (e.data === "Site 2 Window") { | |
site2Window.close(); | |
window.top.postMessage("Site 2 Frame", "*"); | |
} | |
}; | |
// Step 2 | |
window.addEventListener("message", listener); | |
site2Window = window.open("http://{{hosts[alt][]}}:{{ports[http][0]}}/html/browsers/windows/post-message/resources/third-party-to-first-party-different-partition-same-origin-window.html", "", "noopener=false"); | |
</script> | |
</body> |