Thread: AJAX links
View Single Post
  #2   Spotlight this post!  
Unread 15-03-2011, 17:30
connor.worley's Avatar
connor.worley connor.worley is offline
Registered User
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Berkeley/San Diego
Posts: 601
connor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond repute
Re: AJAX links

Everything seems to work well except the the browser's back button.
I use reallysimplehistory to handle this when working with AJAX. It's really easy to use.

Code:
window.dhtmlHistory.create();

var pageChangeListener = function (newLocation, historyData) {
    if (newLocation == "") {
        // Not accessing an AJAX page
        newLocation= "index";
    }
    // Load the page elsewhere (i.e. your programmer will need to implement this)
    loadPage(newLocation);
}

window.onload = function () {
    dhtmlHistory.initialize();
    dhtmlHistory.addListener(pageChangeListener);
    pageChangeListener(window.location.hash.slice(1));
};

Last edited by connor.worley : 15-03-2011 at 17:34.