I am using the app creator and trying to react to close tab window event using the code below. I then preview the app in a separate window, but when I close the tab I don't get the confirmation pop up. When I inject this code in the js console it works as expected. Doesn't cloudfare app support such functionality?
window.onbeforeunload = function (e) {
// Your logic to prepare for 'Stay on this Page' goes here
return "Please click 'Stay on this Page' and we will give you candy";
};