How can I display a confirm message when user click on the software close button (X / Alt+F4) of a Cordova application running on windows 10 (desktop). I have tryed few things but nothing work:
//This only fire when clicking on the back arrow.
document.addEventListener("backbutton", onBackKeyDown.bind(this), false);
function onBackKeyDown(e) {
navigator.notification.alert('onBackKeyDown');
}
//This fire but to late and cannot cancel or display message
document.addEventListener( 'pause', onPause.bind( this ), false );
function onPause() {
debugger;
navigator.notification.alert('onPause');
};
//This is never fired
WinJS.Application.addEventListener("unload", unloadEv);
function unloadEv(ev) {
navigator.notification.alert('unloadEv');
}
//This is never fired
window.onbeforeunload = onbeforeunload;
function onbeforeunload(evt) {
navigator.notification.alert('onbeforeunload');
}
Thanks