title: Detect browser (tab) closing or reloading on Vue
body: <p>I am currently using window.onbeforeunload function on my vue to detect browser's closing or reloading tab to show a  like below.</p>
  <pre><code>  mounted: function () {
      window.addEventListener('beforeunload', this.confirmSave)
    },
     methods: {
      confirmSave(event) {
        if (this.onChangeMode) {
          event.returnValue = 'You have some unsaved changes'
          return 'You have some unsaved changes'
        }
      },
    },
  </code></pre>
  <p>It's working perfectly on PC Chrome but not working on iPad (both Safari and Chrome). My iPad version is 14.0.1.
  I also tried something else like pagehide but not working either.</p>