Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

One page, URL changes during scrolling- how does this work?

Check this out: http://www.thedailybeast.com/articles/2013/12/15/homeland-finale-shocker-the-showtime-series-says-goodbye-to-a-key-character.html

When I scroll past the first article the URL changes when the second article loads. It's a seamless experience.

But how does it work?

What technique are they using to make the URL change when you get further down the page?

1 Answer

It doesn't use JavaScript it's actually an HTML5 API history.pushState()

There's a tutorial on Changing the browser-URL without refreshing page

Here's the MDN page on Manipulating the browser history