0

I have added a event listener for when the user tries to leave the page with beforeunload.

window.addEventListener('beforeunload', function (e) {
            var message = ' You have not saved your changes. ', e = e || window.event;
            if (e) {
                e.returnValue = message;
            }
            return message;

        });

The problem I'm having it's with IOS devices ( mobile safari). I know beforeunload is not supported in safari. How will I fire a similar popup in IOS? I've tried pagehide but it's not launching the confirm popup also.

Bruno M.
  • 1
  • 2
  • Take a look at the answer to [this](https://stackoverflow.com/questions/18783535/jquery-beforeunload-when-closing-not-leaving-the-page) post :) – C.RaysOfTheSun Oct 09 '18 at 08:51
  • @C.RaysOfTheSun I want to catch the event that happens when the user trues to close the page itself(or tab) . beforeunload event does not work on ios devices ( mobile safari ) and the event they recommend pagehide also does not fire the popup in the code above ( changing the beforeunload to pagehide). – Bruno M. Oct 10 '18 at 09:20

0 Answers0