How do soundcloud keep music playing on when navigating?

KwiZ picture KwiZ · Aug 28, 2013 · Viewed 9.2k times · Source

I'm wondering how soundcloud can play music seamlessly when navigating between pages. It's possible that they use Ajax cuz the top bar seems not to reload when navigating but i see the URL changes. Is there any way to load content using Ajax and set the URL to another one?

Answer

Misha Reyzlin picture Misha Reyzlin · Aug 28, 2013

HTML5 has introduced a new API, called HTML5 History API. You can read about using it here – http://diveintohtml5.info/history.html

This API lets you update browser address bar with JavaScript, so you can change the contents of the page according to the URL. The use of AJAX doesn't really have to do with UI changes, you could check the networks tab in Chrome's developer tools to see that requests are issued with XHR.