2

http://www.beatport.com

How are they doing that?

They are changing the url in the browser without using hash like # characters and stuff like that. And without refreshing, just ajax :|

The URLs look like normal URLs, you can go from the homepage directly to http://www.beatport.com/genre/psy-trance/13 without page refresh

BiberFiver
  • 167
  • 1
  • 2
  • 5
  • It ends up as http://www.beatport.com/#genre/psy-trance/13 (YES the # is in there) after it loads. The same happens with the other links on the page. when hovering over them the # is not shown but after the link is clicked/loaded the # is in the location. – Eddy Aug 09 '11 at 18:47
  • it's not there!!1 :D all links are normal, no `#` and the urls too.. Is this black magic or something? – BiberFiver Aug 09 '11 at 18:48
  • It depends on whether your browser supports HTML5 History or not. Try with some old IE or FF 3.6> to see the hashes. – Gustav Barkefors Aug 09 '11 at 18:51
  • Im using Opera. What other browsers support html5 history? – BiberFiver Aug 09 '11 at 18:52
  • It adds a # in the url in IE10 it doesn't on FF4 – Eddy Aug 09 '11 at 18:54
  • http://stackoverflow.com/questions/4612598/which-browsers-support-the-html5-history-api – Gustav Barkefors Aug 09 '11 at 18:54

3 Answers3

3

You can do it using the History API.

http://diveintohtml5.ep.io/history.html https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history

DanBeale
  • 310
  • 4
  • 15
Eduardo
  • 22,574
  • 11
  • 76
  • 94
  • this is sick... now there's no reason not to use ajax for everything – BiberFiver Aug 09 '11 at 18:51
  • Of course there is. It just changes the location url. It won't load the new page for you. You still need to use Ajax to get the new content and append it to the page. It just solves the problem with back buttons on AJAX websites. – Eduardo Aug 09 '11 at 18:54
  • yea, but that was the only problem with ajax. now it's gone so you can use ajax to get new pages. I'm going to hook on live(click) all my links and replace all body elements with the ones from the target page :) – BiberFiver Aug 09 '11 at 18:57
  • Feel free if you don't need to support iE – Eduardo Aug 30 '11 at 19:33
1

They're probably leveraging the HTML 5 History API.

DanBeale
  • 310
  • 4
  • 15
AKX
  • 152,115
  • 15
  • 115
  • 172
0

Correcting my previous answer, see Modify the URL without reloading the page. See the second answer.

Community
  • 1
  • 1
Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308