You can, however, add a beforeunload listener which prompts for confirmation:
var algorithmToApply = 0;
window.onbeforeunload = function() {
if (algorithmToApply !== 0) { /* Anything ..*/
return 'A task is pending. Do you really want to leave?';
}
};