I've fixed the first problem with this bit of code...
# suitescript
a
I've fixed the first problem with this bit of code. But the 2nd problem remains. window.onbeforeunload = null;