load-into-the-iframe.html (674B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 </head> 6 <body> 7 <iframe sandbox="allow-scripts"></iframe> 8 <script> 9 let frame = document.querySelector("iframe"); 10 let sandbox = new URL(location.href).searchParams.get("sandbox"); 11 if (sandbox) { 12 frame.sandbox = sandbox; 13 } 14 // We're the popup (i.e. a top frame). Load into the iframe the page 15 // trying to modifying the top frame and transmit the result to our 16 // opener. 17 onmessage = function(e) { 18 opener.postMessage(e.data, "*") 19 } 20 frame.src = "iframe-that-performs-top-navigation-on-popup.html"; 21 </script> 22 </body> 23 </html>