I made a script which shows posts wall, lets to comment and delete posts. It works fine. But when I’m going to another page and trying to get back, I see no changes made, only the content rendered on pageload (added comments and other actions are not shown).
When I refresh it, I get my changes, because they were saved in database.
I’m not using backbone navigation, because posts wall is only place in website where backbone is used.
So the problem is, backbone is not saving changes to DOM or whatever to see them when navigating back.
Maybe someone knows how to solve this problem? Because users will think actions have not been saved and repeat them again.
Are you using Backbone to enhance a page that is rendered server-side, i.e. Backbone is not fetching the data with an AJAX request and building the DOM to an empty page?
If this is the case, the issue is not with Backbone, but with browser caching. The browser is rendering a cached copy of the HTML it received the previous time it requested that URL. The browser doesn’t know or care that Backbone modified the DOM while you were on the page.
Try configuring your server to provide the following HTTP response headers to instruct the browser not to cache a copy of the page:
The headers are explained in this Stack Overflow thread.