page-lifecycle icon indicating copy to clipboard operation
page-lifecycle copied to clipboard

beforeunload not working in iOS browsers

Open akshatgautam opened this issue 5 years ago • 5 comments

I am trying to display the "Are you sure you want to leave" prompt using the beforeunload event. However, it does not work in iOS, neither in Safari nor in Chrome. I am using the addUnsavedChanges method. Am I missing something?

akshatgautam avatar Aug 25 '20 05:08 akshatgautam

Might not be a good idea to use this library since this library is not being actively managed to keep in sync with browsers updates

tonystaark avatar Nov 20 '20 04:11 tonystaark

Hi @tonystaark,

Maybe you can tell me how to correctly catch the events of closing the browser tab on IOS 14?

Thanks

yura999999999 avatar Jan 28 '21 13:01 yura999999999

@philipwalton some updates?

yura999999999 avatar Jan 28 '21 13:01 yura999999999

As far as I know, Safari on iOS (which includes the WebView used by Chrome) does not fire the beforeunload event. In other words, this is not something this library can prevent.

philipwalton avatar Jan 29 '21 20:01 philipwalton

@philipwalton thank you

yura999999999 avatar Feb 01 '21 16:02 yura999999999