opener-setter.html (668B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <html> 4 <p>This window should set the window.opener attribute</p> 5 <script src="/common/PrefixedLocalStorage.js"></script> 6 <script> 7 var prefixedLocalStorage = new PrefixedLocalStorageResource({ 8 close_on_cleanup: true 9 }); 10 function checkOpener () { 11 if (window.name == 'iShouldSetOpenerToNull') { 12 window.opener = null; 13 return prefixedLocalStorage.setItem('openerIsNull', window.opener === null); 14 } 15 if (window.name == 'iShouldSetOpenerToTest') { 16 window.opener = 'test'; 17 return prefixedLocalStorage.setItem('openerIsTest', window.opener === "test"); 18 } 19 } 20 </script> 21 <body onload="checkOpener()"> 22 </body> 23 </html>