4

This appears to be a bug in StackOverflow and on other StackExchange sites. I only so far tested with Firefox:

  1. Edit a question or answer, or add a comment, save it
  2. Go to another page in the same tab
  3. Hit back in your browser
  4. You will now see the status from before your edit.

The same is true for up-/downvotes, comment votes, comments by others, edits or new answers by others (even the "there is a new answer" will re-appear).

And it can be observed in the top-left under Recent inbox messages and Recent achievements. If they had a notification and in the following page you clicked that away, after clicking back they are back again.

(It gets even weirder if you go further back in history, i.e. if you edit/comment a post, see a new message, go to another post, go further the previous post and so forth a few times: then hitting the back-button a few times you will literally see all earlier versions of your post)

I assume the browser takes the page from the local cache and the AJAX-updated parts are not in that cache. But it is often confusing behavior. Not sure it is trivial to resolve though.

Edit: the potential duplicate is 5 years old and this behavior appears to have either gotten worse or was silently fixed for a while and now has returned. So I propose to keep it open for a while.

4
  • 1
    I don't think it's a bug. Back button shouldn't "reload" all the client side scripting actions hat happened while you were in the page. Sep 7, 2015 at 22:25
  • @ShadowWizard that is a programmer's decision. As this page shows, it is not that hard to do. More info at this old SO answer. You do not need to reload the whole page to maintain state.
    – Abel
    Sep 7, 2015 at 22:31
  • @ShadowWizard, maybe a duplicate, but perhaps after 5 years time to revisit it. I just had it with this page as well, with only your first comment re-appearing after forward/back actions. It is really annoying after a while and many commercial sites manage to do this right (and many don't, admittedly).
    – Abel
    Sep 7, 2015 at 22:34
  • I don't think this should be revisited. In my opinion, back button should not be used, and if used should be expected to lose state. Sep 8, 2015 at 6:09

1 Answer 1

0

I'm not sure what you are expecting.

Using your same list, but with the outcome (4) changed:

  1. Edit a question or answer, or add a comment, save it
  2. Go to another page in the same tab
  3. Hit back in your browser
  4. You will now be on the page where you were before you edited it, because you used your browser back button, which traverses back to previously viewed data

It's a bit like reading a book where on page 50 the hero is chained up, and by page 52 he breaks free and fights with blood, sweat, and tears with his sword, and then expecting to go back to page 50 and him not be chained up any more.


Sure the site could technically do this, but it's a lot of work for nothing, and it's unnatural to go back to previous page/data and it be changed. There are some considerations with POST and GET to consider too, things in the future shouldn't really change things in the past.

Just refresh the page, or use the site links like "return to question" etc.

10
  • 1
    I don't follow your comparison. It is more like on page 50 you use a marker, after page 52 you browse back, and hey, all your marked lines are gone! It is not that at SO you submit and go to a new page, you stay on the same page and annotations (like this comment) are appended to it. And suddenly they disappear if you go away and back again... Really? People do not expect a page to suddenly change back to what it was before they changed it. It keeps hitting me that I lost my changes (a reflex, I know, but still).
    – Abel
    Sep 7, 2015 at 23:00
  • 1
    Also, I believe this is a common programming idiom when dealing with AJAX, commonly known as the Fix the Back Button idiom.
    – Abel
    Sep 7, 2015 at 23:06
  • "People do not expect a page to suddenly change back to what it was before they changed it." You're missing the point. Your browser back button goes back through your browser data, so you see the question unedited because you browsed back to when it was not edited.
    – James
    Sep 7, 2015 at 23:06
  • Yes, that is one way of looking at it. So if I'm on a shopping site, I add something to my basket (I stay on the page). I go googling something and I decide to go back. Oops, basket empty. Really, I don't believe that is what users would expect (and for all web shops I have built, this is a common and important request, as otherwise their support gets swamped — granted, they'll have less tech-savvy users).
    – Abel
    Sep 7, 2015 at 23:09
  • No, I would expect my shopping basket to be as it was when I was on that page. I want it to be like that, because then I can go back if I want to. By introducing a change to a page I have in my history, you are changing my history and removing control from me. It's not like you actually empty the basket, I just have to refresh, or go forward again.
    – James
    Sep 7, 2015 at 23:11
  • I understand your point, but that is far from user-friendly, and imnsho serves no use-case, as that page is gone and shows an invalid, incorrect, out-of-date state (it feels like: open MS Word, edit something and click save, open another document, go back to your previous document, oh, you lost your changes! Yes, we didn't want to save state for you...)
    – Abel
    Sep 7, 2015 at 23:13
  • "Yes, we didn't want to save state for you" But that is a counter argument to what you want. By not changing the history state it is being saved. Then you can go back to previous data, or go forward to new data, or refresh to have the server send you up-to-date data, etc. If you change things when I go back then you have removed my "Browser history" from me.
    – James
    Sep 7, 2015 at 23:18
  • I think we have a different idea of what a page in history should look like. In my opinion, if I hit back, I expect it to see it as historically accurate, i.e., exactly the way it was when I saw that page last time, in the same history point. You suggest to revert the state to an older time, namely, the first moment that page was loaded.
    – Abel
    Sep 7, 2015 at 23:24
  • I see where you are coming from, and yes we disagree. But that aside, let's agree at least that for the most part the back button is "old hat" as sites have better UI now and we can navigate around without much need for it. Like when editing a question here just click "Back to the question" etc. Also, "just click refresh"
    – James
    Sep 7, 2015 at 23:27
  • Well, I use the keyboard a lot and hence am accustomed to using the back-space key. I wasn't even aware that link was there, but it certainly isn't there if I go to google, or click another link, and then hit back.
    – Abel
    Sep 7, 2015 at 23:30

Not the answer you're looking for? Browse other questions tagged .