This simple code from jquery is not picking up the unload event. The console says caching is being disabled.
I want users prompted on clicking on each link on my page that leave page, but does not prompt when they close page. Any suggestions.
<html> <script src="jquery-3.1.1.min.js"></script> <body> <a href="https://www.science.gov" id="navigate">science</a> </body> <script> $(window).on('beforeunload', function(){ return('Are you sure you want to leave?')}; </script> </html>