Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<iframe sandbox="allow-scripts"></iframe>
<script>
let frame = document.querySelector("iframe");
let sandbox = new URL(location.href).searchParams.get("sandbox");
if (sandbox) {
frame.sandbox = sandbox;
}
// We're the popup (i.e. a top frame). Load into the iframe the page
// trying to modifying the top frame and transmit the result to our
// opener.
onmessage = function(e) {
opener.postMessage(e.data, "*")
}
frame.src = "iframe-that-performs-top-navigation-on-popup.html";
</script>
</body>
</html>