Page 1 of 1

AJAX and bookmark problem

Posted: Thu May 22, 2008 4:26 am
by the_last_tamurai
Hi ,
My question is how to change the url while the page uses AJAX??
I noticed that a site like facebook when I watch photos .... the photos changes (AJAX) and the url changes with the photo id
How can I do something like this?

Re: AJAX and bookmark problem

Posted: Fri May 23, 2008 12:22 pm
by kaszu
I don't know about facebook, but only way i can think of is to change hash not the url

Code: Select all

var pos = document.location.href.indexOf('#');
if (pos != -1) document.location.href = document.location.href.substr(0, pos);
document.location.href += + '#myPhoto1';
And each time page is loaded hash needs to be checked and previous state restored, otherwise it's useless.