close-opener.html (778B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <html> 4 <body onload="closeOpener()"> 5 <p>This window should close its opener.</p> 6 <script src="/common/PrefixedLocalStorage.js"></script> 7 <script> 8 var prefixedLocalStorage = new PrefixedLocalStorageResource({ 9 close_on_cleanup: true 10 }); 11 var prefixedLocalStorage = new PrefixedLocalStorageResource({ 12 close_on_cleanup: true 13 }); 14 function closeOpener () { 15 if (window.opener) { 16 window.opener.close(); 17 18 // Give the browsing context a chance to dispose of itself 19 function waitForContextDiscard () { 20 if (window.opener === null) { 21 return prefixedLocalStorage.setItem('openerIsNull', 'true'); 22 } 23 return setTimeout(waitForContextDiscard, 0); 24 } 25 waitForContextDiscard(); 26 } 27 } 28 </script> 29 </body> 30 </html>