Assigning a message to e.returnValue
will cause the browser to show an "Are you sure you want to leave this site?" prompt. However it is not always guaranteed to appear, and most browsers ignore the exact message you provide and just show their own stock message.