i have a page on which i want to confirm if the user wants to leave. i have to confirm only when a certain condition is met so i wrote code like this
var bac
Condition for back-end
var confirmExist = function (e) { return true; } window.onbeforeunload = confirmExist; http get, post request .then(function(r)) { window.onbeforeunload = null; }