Grow your CSS skills. Land your dream job.

Trouble with history.js and AJAX

  • # April 29, 2013 at 7:31 pm

    I’m working on a site that uses a heavily customized version of [borwserstate/ajaxify](https://github.com/browserstate/ajaxify “borwserstate/ajaxify”). The script “Ajaxifies” links on the page and uses [history.js](http://github.com/browserstate/history.js “history.js”) to change the web browser URL using HTML5 History/State API. The way I have the site developed is intended to give an Ajax experience only when landing on the home page where internal pages are pulled in and display. But if you land on an internal page there is no Ajax experience. Also, the script hooks onto the browsers back/forward events, so when browsing the site, you can use the back/forward buttons to get the AJAX experience.

    The problem I am having is related to the fact that internal pages do not have an Ajax experience, internal pages only have content, and no scripts. Here is how to simulate the issue:

    Using Chrome (or another browser that supports HTML5 History/State API)

    User lands on http://dustinwoods.net/village/

    User clicks an “Activity”

    User refreshes page (F5)

    User presses back button on browser

    User is not taken back to home page, instead the user remains on the current page (however the URL changes back to the home page URL) **< -- This is the issue!**

    If anyone has any pointers on this subject, please chime in. I can usually debug all of my issues, but I am at a loss here. One of my thoughts is to add the AJAX script to the internal pages, but I want to avoid this, and further more, I want to understand why this is happening.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".