Can I have a prompt before navigating to another page

I have a editor page, I want to give user a prompt when user try to navigate away if the work is not saved .
I found something like this for react, I am wondering if readwood router can do something like this:
https://javascript.plainenglish.io/how-to-alert-a-user-before-leaving-a-page-in-react-a2858104ca94

Thanks!

That might be a react router v6 limitation unfortunately, you can see here: https://github.com/remix-run/react-router/issues/8139

Scratch that answer, I don’t know why I thought redwood used react router v6… It doesn’t, but I don’t see any possibility for prompt with the redwood router

Thanks

The standard way of handling this is the beforeunload event. Does that not work for you? There is nothing built-in to the redwood router for this

will before unload be fired when switch route?