browser close confirmation javascript code example Example: js ask before close window.onbeforeunload = function() { return ""; }