Can the browser be redirected to another page upon closing?
Various Methods Tried:
Attempted using onunload, but unsuccessful
window.onunload = function redirect(){...}
Another method tested, also unsuccessful:
window.onbeforeunload = redirect(){...}
<body onbeforeunload="return false; redirecty()">
In the 3rd method, the goal was to delay the browser closure by canceling onbeforeunload
, and then call the redirect function using window.confirm
. If confirmed, redirection would take place. However, this approach did not yield the desired results.
Are there any alternative solutions? Perhaps a prompt could be used to allow the user to choose whether to redirect to a new page upon browser closure. The brainstorming process continues...