Mariage: fixing the history/search/ajax interaction
Posted by mholmes on 28 Oct 2016 in Activity log
Worked with GN to fix some issues we've identified with AJAX searches which are pushed into the history stack with JavaScript. The solution (in search.js) depends on a couple of factors:
- When a page reloads as a result of the use of the back button, the window's onload event does not fire, therefore the URK is not parsed and the search is not done. The solution here is to use the window's onpopstate event to trigger the same behaviour.
- When a search is sent off and a new URL-encoded version of that search is ready to be pushed into the history stack, check that it's not identical to the current one; if it is, don't put it in the stack, otherwise you'll have two copies of the same URI in the stack.
Current solution tested and working on Chromium and Firefox.