What I'm trying to accomplish is the following:
If the user tries to close the window the alert pops up and I want to change the text so a user has the option to leave the page or can choose to stay and redirect to another page.
Probably searching for it in the wrong way but I really can't find anything that works.
What I have so far:
window.onbeforeunload = function() { /*...*/ }
I need to know how to adjust the text of the alert and add a handler on the stay button.