Execute function before refresh November 19, 2022 by Tarik window.onbeforeunload = function(event) { return confirm("Confirm refresh"); };