History API Question
How does Discourse get the history API to update the URL for every reply, but still allow the back button to take the user to the previous page? This would be very useful for a project I'm working on, but I can't seem to phrase my search appropriately to find the answer on Google.
riking last edited by
window.history.pushState()for the back button and
I experimented with replaceState(), but it seemed to be screwing with the history of previous pages. I'll try again tonight if that's the correct method.
Thanks for your help.
VinDuv last edited by
There is some info and a demo on http://diveintohtml5.info/history.html, if you’re interested.
That looks very useful; I'll check it out this evening.
The replaceState() method is working correctly now. I'm not sure what I was doing wrong before.