I now have:
window.onbeforeunload = confirmFirst;
function confirmFirst() {
return "Leave the page?";
}
This can give users a prompt to confirm that they are leaving the page on all major browsers, except on iOS safari. How can I make it work?
I want to implement this as my users often accidentally swipe right (back button) and left the page after typing in some long paragraphs on my site. Thank you!