0

Recently I've noticed that if we are at our profile view/url (http://twitter.com/profileName) and click on one of our tweets to see its details on popup, the url changes (http://twitter.com/profileName/status/statusId) without reloading the page (no # in url used).

With further investigation, I've noticed that window.history changes, from:

{ title: "profileName (@profileName) | Twitter" }

to:

{ inOverlay: true, rollbackCount: 1 }

I'm currently working on own Single Page App stack, and stuck on writing own router - looking forward for alternatives against currently trending # usage and thought that understanding this twitter hack can help me a bit.

lukaszkups
  • 5,790
  • 9
  • 47
  • 85
  • I saw that thread earlier, but wasn't sure if twitter uses same mechanism (so I've created this thread) - anyway, it can be closed now. thanks! – lukaszkups Dec 02 '16 at 18:40

1 Answers1

2

They use the HISTORY API:

window.history.pushState("", "", '/newpage');

Reference: https://blog.twitter.com/2012/implementing-pushstate-for-twittercom

paolobasso
  • 2,008
  • 12
  • 25