<html> <head> <title>Loading...</title> </head> <body onload="attachUnloadListener()"> <script> function attachUnloadListener() { window.addEventListener('unload', onUnload, false); document.title = "sync xhr on unload"; } var req = new XMLHttpRequest(); function onUnload() { req.open('GET','download-test1.lib', false); req.send(null); } </script> <p>Navigate to another page to trigger synch xmlhttprequest</p> </body> </html>