On your website you are looking for a way to notify your user that they are about to navigate away from your site and that any information that has not been saved will be lost.

The solution is really simple. Just listen for the ‘onbeforeunload’ event.

My example here is using jQuery.

$( window ).bind( "beforeunload", function () {
return 'All unsaved data will be lost.'
} );

Confirm Navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>