How to detect the page is about to refresh in Nextjs?
Unanswered
Transvaal lion posted this in #help-forum
Transvaal lionOP
Hi, is there a way to detect the page is about to refresh in Nextjs? The onbeforeunload event is not supported in iOS 😦
2 Replies
It's a native browser API issue, IOS doesn't support many events and features. Besides IOS, other similar events are not fired reliably,
Some people suggest using
Some people suggest using
unload can work on IOS devices, but usually I recommend saving the state periodically if you can.Also, You may use on window
blur and focus listener to achieve similar functionality