I recently came across a small problem in RSH whereby on loading a page with a state in the url (e.g. localhost.com/test_page#test) would not trigger the history listener function on it’s initial load. To fix this, I needed to modify my window onload function to include a call to my history listener, as follows:


history_listener: function (newLocation, historyData) {
...
},

// Window.onload calls this
initialize_history: function () {
       	dhtmlHistory.initialize();
       	dhtmlHistory.addListener(this.history_listener.bindAsEventListener(this));

       	// Added this line to force a call to my history listener
       	this.history_listener(dhtmlHistory.getCurrentLocation());
}

This ensures that when the page is freshly loaded, the history listener is called with the contents of our initial location.

Post a Comment

*
*