AJAX and bookmark problem

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
the_last_tamurai
Forum Commoner
Posts: 87
Joined: Wed Feb 28, 2007 8:24 am
Location: cairo
Contact:

AJAX and bookmark problem

Post 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?
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: AJAX and bookmark problem

Post 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.
Post Reply