javascript - How to use JS detect user close page on Safari -
i want detect user close page using js, in chrome/firefox use onbeforeunload event, in safari (on macos , ios) doesn't work (but mdn work...)
in safari on macos, onbeforeunload work first time refresh/close page.
i try unload, beforeunload, pagehide not work.
please try following.
window.unload = function () { // add code here };
here documentation https://www.w3.org/tr/dom-level-2-events/events.html
Comments
Post a Comment