You can handle this with javascript on your page.
First create a function:
function closeMessage() { return "Are you sure you want to leave this page"; }
After that, assign this method:
window.onbeforeunload = closeMessage;
Please let me know if it was helpful.
Davi ruiz
source share