I am loading data in the web page via ajax, and using pushstate and popstate trickery to change the browser address field. The problem is that my ajax URLs are like so
2011/07/25/foo.txt
2011/07/26/bar.txt
2011/07/27/baz.txt
So, the first time the web page loads, the browser address field is http://webserver/. On the first ajax load, it becomes http://webserver/2011/07/25/foo.txt. On the second ajax load it becomes http://webserver/2011/07/25/2011/07/26/bar.txt. On the third ajax load the browser URL field becomes http://webserver/2011/07/25/2011/07/26/2011/07/27/baz.txt. In other words, only the last fragment of the address field (split on ‘/’) gets replaced.
How can I replace the entire address field?
Add a leading
/to the pushed path.