Reputation: 123420
I am using the HTML5 history API
I notice that if:
The event handler for window.onpopstate() returns the state for /first, as documented.
In order to transition from /second to /first, I would like to see the URL that was popped - ie, /second in this case. What's the best way of doing that?
Upvotes: 0
Views: 403
Reputation: 123420
In lieu of a proper answer, I've implemented the following workaround:
data-urlhack
attribute on the <body>
element when a page is loadedonpopstate()
handler, checking the value of this attribute so I can transition from this page (where the back button was hit) to the page the back button has sent us to.Also ensure that pages loaded in onpopstate()
don't try and push use pushState()
themselves.
Upvotes: 1