Detecting if switching using history API
Is there a consistent way to determine if a popstate was called by a Back or Back button click?
I am currently keeping the timestamp in the state when a new page is added, which means the navigation is working correctly for most parts, but if for example there are three pages loaded with history.push and the user navigates back to the second and refreshes its, the timestamp is updated and so the animation starts to get weirder because the forward now refers to the page with a lower timestamp, causing the animation to reverse.
The behavior can be reproduced at http://goo.gl/26MlRW by adding two screens, then going back once and refreshing the page.
Example code: http://goo.gl/pDGctA
+3
source to share