1 <html> 2 <script> 3 4 var iframe; 5 6 window.addAndTransferIframe = function() 7 { 8 iframe = document.createElement('iframe'); 9 iframe.setAttribute('width', '500'); 10 iframe.setAttribute('height', '350'); 11 iframe.setAttribute('src', 'iframe-reparenting-close-window-iframe.html'); 12 window.document.body.appendChild(iframe); 13 } 14 15 // Called from Iframe when it is loaded and initialized. 16 window.transferIframe = function() 17 { 18 var backgroundWin = window.opener; 19 backgroundWin.log("Transferring Iframe now."); 20 backgroundWin.document.adoptNode(iframe); 21 backgroundWin.document.body.appendChild(iframe); 22 iframe.contentWindow.finish(); 23 window.close(); 24 } 25 </script> 26 27 <body> 28 </body> 29 </html>