xhr-with-pagehide-1-helper.html (427B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script> 5 function redirectAndFireXHR() { 6 const XHR = new XMLHttpRequest(); 7 document.location.assign('data:text/html,final iframe content'); 8 XHR.open('GET', 'data:text/html,1', false); 9 XHR.send(); 10 } 11 12 function handlePageHide() { 13 window.parent.finishTest(); 14 } 15 </script> 16 </head> 17 <body onload="redirectAndFireXHR()" 18 onpagehide="handlePageHide()"> 19 initial iframe content 20 </body> 21 </html>