I have a page that is manipulated via Ajax. The user navigates away from the page or hits the back button. When they return with either back or forward, it completely resets the page to it's original state.
Here is the ticket that explained to me why this is happening with jQuery: http://dev.jquery.com/ticket/3015 Here is a simple example of how I can revert the behavior and have the alert only run once as I expect: $(document).ready(function(){ alert("test"); $.event.remove(window, "unload"); }); This seems like it would be a bad idea, considering that jQuery put this fix in place for a reason. So, what am I supposed to do to maintain changes made to the DOM? Here is the actual scenario I'm running into: There is a login form at the top of our homepage. When the user hits submit, the request is sent via Ajax. The response is a script that flashes a message and replaces the login form with a set of links including a 'sign out' link. The user goes to the next page and decides to hit the back button. The login form is back even though the user is logged in. If I turn bfcache back on by removing the unload event, it works perfectly. What are my options if I leave it off which seems to be the way jQuery wants it? One thing I can think of is resending the request to the server for each part of the page that is dynamic and having all of the response scripts run again, but doing that on every back/forward seems like it should be unnecessary. Thanks, -Awgy