1 <html> 2 <head> 3 <title>Loading...</title> 4 </head> 5 <body onload="attachUnloadListener()"> 6 <script> 7 function attachUnloadListener() { 8 window.addEventListener('unload', onUnload, false); 9 document.title = "sync xhr on unload"; 10 } 11 12 var req = new XMLHttpRequest(); 13 function onUnload() { 14 req.open('GET','download-test1.lib', false); 15 req.send(null); 16 } 17 </script> 18 <p>Navigate to another page to trigger synch xmlhttprequest</p> 19 </body> 20 </html> 21