file_bug1550792.html (1048B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 </head> 6 <body> 7 <iframe id="nestframe"></iframe> 8 <script> 9 let nestframe = document.getElementById("nestframe"); 10 11 window.addEventListener("message", (event) => { 12 parent.postMessage(event.data, "*"); 13 14 // Only create second iframe once 15 if(event.data.type === "https") { 16 return; 17 } 18 19 nestframe.contentDocument.body.innerHTML = ` 20 <iframe id="frametwo" 21 src=\"https://example.com\" 22 onload=\"parent.postMessage({status:'loaded', type: 'https'}, '*')\" 23 onerror=\"parent.postMessage({status:'blocked', type: 'https'}, '*')\" 24 ></iframe>`; 25 }); 26 27 nestframe.onload = (event) => { 28 nestframe.contentDocument.body.innerHTML = ` 29 <iframe id="frameone" 30 src=\"http://example.com\" 31 onload=\"parent.postMessage({status:'loaded', type: 'http'}, '*')\" 32 onerror=\"parent.postMessage({status:'blocked', type: 'http'}, '*')\" 33 ></iframe>`; 34 } 35 36 nestframe.src = "about:blank"; 37 </script> 38 </body> 39 </html>