before-unload-inner.html (702B)
1 <!DOCTYPE html> 2 <script src="utils.js"></script> 3 <title>Fenced frame content to report the beforeunload event is not fired</title> 4 5 <body> 6 <script> 7 window.onload = () => { 8 const [before_unload_key] = parseKeylist(); 9 const url = new URL(location.href); 10 const next_url = url.searchParams.get('next_url'); 11 12 if (next_url != null) { 13 writeValueToServer( 14 before_unload_key, 'Loaded the next url in a fenced frame'); 15 return; 16 } 17 18 window.onbeforeunload = () => { 19 writeValueToServer( 20 before_unload_key, 'The beforeunload event is unexpectely fired.'); 21 }; 22 23 location.href = 24 generateURL('before-unload-inner.html?next_url', [before_unload_key]); 25 }; 26 </script> 27 </body>