1

I know how to change content of a page using AJAX and remote loading of content. However, take a look at UStream's new layout. Click on any video, and not only does the content change without changing the page itself... but the entire URL changes as well. How is this done?

I know how to do it using the hashtag in a URL, and using JavaScript to detect when the location's hash value has changed. For example, site.com/#!/profile to site.com/#!/settings. Any value after the #! part is loaded remotely.

But UStream doesn't use the hash symbol at all. How is this accomplished? What voodoo is at work here?

TerranRich
  • 1,263
  • 3
  • 20
  • 38
  • 1
    Try: https://github.com/aFarkas/history.js – Jared Farrish Oct 21 '12 at 23:58
  • @JaredFarrish That fork is better than the original? – alex Oct 21 '12 at 23:59
  • 1
    @alex - Um, yeah, sure. This one? https://github.com/balupton/history.js Are you setting me up? – Jared Farrish Oct 22 '12 at 00:00
  • @alex - Are you there? Were you simply pointing out I didn't point back to the source, or did you have an actual problem with the link to aFarkas' fork? – Jared Farrish Oct 22 '12 at 00:11
  • @JaredFarrish No problem at all. I was just curious if it was recommended over the original (maybe I'd missed some discussion). – alex Oct 22 '12 at 00:18
  • @alex - Ah, sorry, been sniped a few times today. Honestly, I don't know the answer. Seems there is some frisson in the history business, but to be honest, I got so many links by now, I'm wondering what's best. That was my best guess. Seems like there's another approach, but can't find it at the moment. – Jared Farrish Oct 22 '12 at 00:20
  • @alex - This was my answer on a previous (and not too distant) question: http://stackoverflow.com/questions/12446317/change-url-without-redirecting-using-javascript/12446647#12446647 (Backbone.js stuff, of course.) – Jared Farrish Oct 22 '12 at 00:27

1 Answers1

3

You're seeing the HTML5 History API.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
  • This seems like the most likely method being employed by these sites. Good to know it's an HTML5 feature. Thanks! – TerranRich Oct 22 '12 at 19:21