I was surprised by this problem in IE10 when using the back button to go to a page whose DOM had been modified:
I would have been happy with either behaviour 1 or 2, but not 3:
- properly restore the entire state (like FF and Chrome do)
- reload the page (as it shouldn't be cached) and the current state could be recreated because changes were pushed to the server via Ajax (IE8 does this)
- but IE10 went back to the initial, unmodified page (it preserves form input, if there was any on the initial page, but not the entire state)
Because I was in a hurry, I just went with forcing a reload if someone accesses the page after making DOM modifications (that piece of info is stored in the hash), which is a pretty dumb solution (FF and Chrome don't need to reload, but now do).
One suggestion was to use localStorage to remember state and I'm guessing this kind of functionality is also rolled into history.js.
To keep a spare copy lying around for comparison / in case state isn't restored seems overkill, especially because in our case this is a problem that would afflict maybe 0.01% of users. For my purposes, it would be sufficient to force a reload if the state has not been saved in its entirety in the bfcache.
Can I "simply" detect whether there is a all-state-encompassing bfcache? If so, I could force a reload in its absence when someone goes back to a page whose DOM was modified?