Home>

There is such an event

window.onbeforeunload= function (e) {
  e.returnValue= "";
};

When closing a tab or browser, such a window pops up,

How to transfer your function to save data by clicking on the close button?

localStorage, sessionStorage

Object4172021-12-25 03:24:12

Well, that is, since I want to do it is impossible? Save only in localStorage?

Viktor2021-12-24 06:23:51

Many browsers do not even allow your message to be sent to this window, so I doubt that you will be able to intercept the result of this prompt.

Object4172021-12-24 08:58:26