Answers for "prevent page refresh with e.preventdefault()"

6

prevent reload javascript

window.onbeforeunload = function() {
  return "Dude, are you sure you want to leave? Think of the kittens!";
}
Posted by: Guest on March-04-2020
0

prevent page refresh

// Can be implemented via window.onbeforeunload.
// For example:
<script type="text/javascript">
    window.onbeforeunload = function() {
        return "Are you sure you want to leave?";
    }
</script>
Posted by: Guest on July-03-2021

Code answers related to "prevent page refresh with e.preventdefault()"

Code answers related to "Javascript"

Browse Popular Code Answers by Language