views:

27

answers:

0

Using Really Simple History http://code.google.com/p/reallysimplehistory/

When I use the following code,

<body>

<a href="#abc">abc</a>
<a href="#abcd">abcd</a>
<a href="#page=3&cat=4">page=3 cat=4</a>
<a href="#page=3&cat=5">page=3 cat=5</a>
<a href="#page=22&cat=33">page=22 cat=33</a>

<script type="text/javascript" src="json2007.js"></script>
<script type="text/javascript" src="rsh.js"></script>

<script type="text/javascript">
window.dhtmlHistory.create();

var yourListener = function(newLocation, historyData) {
    //do something;
    console.log(newLocation, historyData)
}

window.onload = function() {
    dhtmlHistory.initialize();
    dhtmlHistory.addListener(yourListener);
    console.log("started")
};
</script>

1) the historyData is always Null. Is it supposed to?

2) So clicking on the links on the page will fire off yourListener(). Also the Back and Forward button on the browser will fire off yourListener(). is it supposed to take whatever given, such as page=22&cat=33 and do whatever is needed to fetch that info through AJAX and put the content on the page?

3) When I go to the page http://www.mysite.com/test.html#abc (when the browser is blank or at another site like google.com), the yourListener() is not fired off… Isn't that the whole point of AJAX history? That it needs to fetch the data when the hash has some content. So shouldn't the yourListener() be invoked? (but maybe Really Simple History is not to support "bookmarking", that's why it is called Really Simple History instead of Really Simple History and Bookmark)