Jump to content

Tracking browser navigation direction history with JS


ghostcoder

Recommended Posts

Ok, I'm using pushState, replaceState and popstate events along with Ajax to change content on a new project I'm working on. The basics are very simple and I've finally got it working well.

 

However, I need to find a way to track and determine when a user is moving forward or back through the browser history, so that I can adjust the transitions properly. In my case, if someone goes back, I want the transition to be left to right, otherwise, right to left.

 

I'm thinking the only way might be in a cookie. The system needs to remember history even if the person backs out of the site. ( as in, if you first load phpfreaks.com and the navigate to a site, move around a bit and then use the back button to go back to phpfreaks. Then, you may decide to click forward again to the site.

 

Does anyone have any ideas on the easiest way to do this? Keeping some sort of array in a cookie, maybe?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.