Possible Duplicate:
How does facebook rewrite the source URL of a page in the browser address bar?
Maybe this is a silly question, and I apologize if it’s a simple one, but I’m not sure if I’m getting the terminology correct so I haven’t been able to find any results with google.
I’m looking to change/modify the current page’s URL (or specifically it’s GET variables) using AJAX. I didn’t think this was at all possible but it appears to be done in Facebook.
For instance when I’m on my facebook profile the url is written:
http://www.facebook.com/profile.php?id=xxxxx&sk=wall
Then if I click on the info link below my profile picture it changes to:
http://www.facebook.com/profile.php?id=xxxxx&sk=info
And there is no page refresh (as far as I can see).
So what’s the deal, how is this done?
AFAIK you cannot change the URL without a refresh except to add a hashtag anchor. You can use the
location.replacemethod:http://www.w3schools.com/jsref/met_loc_replace.asp
Updated to reflect @Crescent Fresh’s link
Looks like there is another option with HTML 5’s
history.pushState()(currently only supported by Webkit):How does facebook rewrite the source URL of a page in the browser address bar?