preventdefault on back in vuejs code example
Example: preventdefault on back in vuejs
<script>export default { // ... beforeMount() { window.addEventListener("beforeunload", event => { if (!this.isEditing) return event.preventDefault() // Chrome requires returnValue to be set. event.returnValue = "" }) }}</script>