When you compose a question/answer on a StackExchange site and then navigate away before submitting it, you get a popup, warning you:

enter image description here



The "Leave Page" button is selected by default.

Is this really the correct choice?

I think the "Stay on Page" button should be the default one.

I just composed a question: I finished a sentence and wanted to start a new paragraph by hitting Enter two times. However, while finishing the last sentence I accidentally hit the key combo for "Page back" in Firefox. Instead of navigating away, the warning popped up, but thanks to me hitting Enter (immediately after) I confirmed the default action → I navigated away and lost my question draft.

I think it boils down to the choice between:

  • 1 more click for users that really want to navigate away (after they have entered some data into a form!)
  • No data loss for users that accidentally try to navigate away

3 Answers 3


This warning is "allowed" by the browser. Each browser implements the behavior differently. However, it is most common to allow the user to "leave this page" by default. The reason is that pages can maliciously prevent you from closing the window with a simple script and the user is forced to take action to leave a page. Making this choice the default, reduces the "friction" that comes from leaving a page.

Stack Exchange is probably the only site(s) that I would say "stay on page." Most of the time, I see this on download-style sites like MediaFly and FileRocket and find the message tedious and annoying.

Leave Dialog for Chrome: enter image description here

Abuse of the Dialog at free-ebooks.net:

enter image description here


These popups are triggered by the user navigating away from the current page. The system cannot know if this has been by accident, and therefore shouldn't assume it is anything but on purpose. If the user gives input it is not the system's job to be like "well, you're saying you want to leave this page, but I think you're mistaken". As you say, it could be by accident, and this confirmation dialog catches that, but it doesn't assume the accident to have happened.

let me help you with that

Confirmations for "risky" actions do have "bail out" as their default action. If you're not really sure you should be doing what you propose to do, it's better to step back and think about it for a moment.

Many situations your confirmation dialog is triggered are not really risky. It'd be a shame to lose a post on a forum, or details in a form, if you forgot to submit it, but it's not the end of the world. There is a fine line between helping a user out and getting in their way. For a website like SE I totally understand "carry on" being the default over "bail out", while for a disk formatting tool it should probably be the other way around.


Generally such communication between system and user should be taken as NOTIFICATION instead of WARNING or DECISION POINT. If I am leaving a page or a site, the site can only inform me that "you are leaving the website now" and that covers everything which I may want to know. In such case the default option could be CONTINUE and additional option to CANCEL and stay on the site.

In case of StackExchange, this communication is a WARNING because you may loose some unsaved data. If you think through this risk of loosing data, default button should be "STAY ON THE PAGE" - but - in reality, there is no risk when you leave a page as AutoSave Function keeps the content there when user returns back to the same page later. This functionality covers the risk part and makes this communication message a NOTIFICATION instead of WARNING and for a NOTIFICATION, default option should be CONTINUE or LEAVE THE PAGE which is rightly implemented.

Hope this answers your question.

  • "in reality, there is no risk when you leave a page as AutoSave Function keeps the content there when user returns back to the same page later": Hm, in case of Stack Exchange sites, the content is not saved when I leave the page. When I immediately go back to the page where I entered/changed content, it is lost.
    – unor
    May 29, 2013 at 8:18
  • Auto-save usually happens periodically after every 30 seconds or so. If you leave a page before auto-save initiates, you will loose your content. May 29, 2013 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.