Capturing [removed]

前端 未结 7 1167
逝去的感伤
逝去的感伤 2020-11-28 08:58

I have a form where the input fields are saved onChange. In Firefox (5) this works even when the window is closed, but for Chrome and IE it doesn\'t and I need

相关标签:
7条回答
  • 2020-11-28 09:53

    I seem to be a bit late to the party and much more of a beginner than any expertise; BUT this worked for me:

    window.onbeforeunload = function() {
          return false;
    };
    


    I placed this as an inline script immediately after my Head and Meta elements, like this:

    <script>
      window.onbeforeunload = function() {
         return false;
      }
    </script>
    

    This page seems to me to be highly relevant to the originator's requirement (especially the sections headed window.onunload and window.onbeforeunload): https://javascript.info/onload-ondomcontentloaded

    Hoping this helps.

    0 讨论(0)
提交回复
热议问题