Reputation: 6279
I thought that JavaScript didn't allow you to update the browser's URL (for bookmarking, etc) without doing a full page refresh. Facebook seems to accomplish this in their photos application, though. When I click "next" to see the next photo, the new photo loads and the URL updates, but the whole page doesn't refresh. Does anyone know how they accomplish this?
Upvotes: 0
Views: 523
Reputation: 45721
They don't update the URL per se, they only update the Hash (i.e # followed by instructions). The hash is never sent to the server, but can be used to go to anchor points in the DOM (built in browser functionality), or used as a hook for JavaScript. Upon page load with a hash variable set, they send an Ajax-request to fetch the corresponding photo. The initial page load will, however, load the picture indicated by the url before the #-character.
Upvotes: 4