file_bug1551886.html (995B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 </head> 5 6 <body> 7 <script> 8 let f = document.createElement("iframe"); 9 f.src = "data:text/html,<iframe src='http://example.com' onload=\"parent.postMessage({status:'loaded', type: 'http'}, 'https://example.com')\" onerror=\"parent.postMessage({status:'blocked', type: 'http'}, 'https://example.com')\"></iframe>"; 10 window.addEventListener("message", (event) => { 11 parent.postMessage(event.data, "http://mochi.test:8888"); 12 13 // Only create second iframe once 14 if(event.data.type === "https") { 15 return; 16 } 17 18 let f2 = document.createElement("iframe"); 19 f2.src = "data:text/html,<iframe src='https://example.com' onload=\"parent.postMessage({status:'loaded', type: 'https'}, 'https://example.com')\" onerror=\"parent.postMessage({status:'blocked', type: 'https'}, 'https://example.com')\"></iframe>"; 20 document.body.appendChild(f2); 21 }); 22 document.body.appendChild(f); 23 </script> 24 </body> 25 </html>