logoalt Hacker News

_fat_santatoday at 2:29 PM1 replyview on HN

> are you sure you want to leave

I would argue there is a place for this in web-apps. For example I have a SaaS app and I employ this on any form pages where the user has already started to enter information in.

I have considered form persistence so in the event a user goes back to a previous page, realizes it's a mistake and goes forward again, their form state from the previous state is persisted.

But I would like to ask, what would users prefer the behavior be on a form page like this?


Replies

lexicalitytoday at 5:33 PM

That's fine, there's already an API for this: https://developer.mozilla.org/en-US/docs/Web/API/Window/befo...

That's very different to sites like tomshardware that pops up a "hey why don't you check out this extra slop you didn't ask for" when you try to navigate away