Hello,
I am trying to use the onunload event of a New record page and I am finding it quite difficult to get it to work on my usual browsers (Chrome and Firefox). The onunload obviously blocks the alert calls. I don't see an option of having an onbeforeunload() event in any of the pages. So may I know as to what is the best way to achieve an onunload functionality on my usual browsers? Kindly let me know.
Cheers.
Hello,
Please check if this code will fit your needs:
<script>
window.onbeforeunload = function() {
return "Did you save your stuff?"
}
</script>
Thank you,
Gian
Hello,
May I know what script are you trying to run on the unload event? Are you trying to display an alert popup? You can try adding this JQuery script to that page.
$(window).unload(function() {
alert( "Handler for .unload() called." );
});
Thank you,
Gian
I've tried it. It doesn't work. I've even tried to call a function in the onunload event of a page and then place the alert in that function using a script component. Still doesn't work.
Hello,
If you just need an alert script you may use the following:
Thank you,
Gian
[mention:c5dec1ce5a5948c5a25cf4bcaeb7db77:e9ed411860ed4f2ba0265705b8793d05] : Sorry dint get the code.
Hello,
Please check if this code will fit your needs:
<script>
window.onbeforeunload = function() {
return "Did you save your stuff?"
}
</script>
Thank you,
Gian
Yes that works. Finally!
Cheers.