Project

General

Profile

Bug #3634

Updated by Phil Hodgson over 9 years ago

Page content can be updated by Javascript and AJAX, but if it is, and one navigates away, and then uses the browser back button (or history) to return to the page, the user will see the *initial* content of the page (as it was previous to the JS and AJAX changes) rather than the *most recent* content of the page. 

 HTML5 allows us to store state in the browser's history stack. 
 * Use replaceState() when changing page/tab content. 
 * When switching tabs, use pushState() or replaceState() and store "which is the current tab" in the history data. 
 * Listen to popstate events. Copy latest page content from the history data to the DOM. 

 Workbench already loads History.js, which offers compatibility with HTML4 browsers. https://github.com/browserstate/history.js 

Back