I would like to execute a function before leaving page without showing a confirmation popup with Javascript only. I\'ve tried with the code below but it did
This is an example of how you could handle the navigate away. Notice how a div appears a little before the navigation occurs.
window.onbeforeunload = function () { $("#oi").append($('This is the child DIV')); }
The Main Div will receive another div before leaving the page Navigate Away