<html> <script> window.onbeforeunload = function(event) { event.returnValue = 'Test beforeunload handler'; } </script> <body> Test page </body> </html>