<html> <head> <title>Loading...</title> <script> window.onunload = function(e) { return 'foo'; }; </script> </head> <body> <p>Navigate to another page to trigger unload handler.</p> </body> </html>