Black lives matter
Portrait Dr. Axel Rauschmayer
Dr. Axel Rauschmayer
Homepage | Twitter
Cover of book “JavaScript for impatient programmers”
Book, exercises, quizzes
(free to read online)
Cover of book “Deep JavaScript”
Book (50% free online)
Cover of book “Tackling TypeScript”
Book (first part free online)
Logo of newsletter “ news”
Newsletter (free)

Twitter to eliminate their hashbang (#!) URLs

(Ad, please don’t block)

In a conversation triggered by Tim Haines, Twitter front end engineer Dan Webb refers to his article “It's About The Hashbangs” on the problems of using #! URLs in JavaScript. He then goes on to confirm:

plus, now I'm in charge of undoing twitters hashbang URLs I can confirm that all the issues in that article are very real.
x months from now (when your project completes) Twitter will no longer use hashbangs?
correct. All gone. It was a mistake for several reasons. PushState or bust.
You're going to revert to page refreshes if the browser doesn't support PushState? Adding PushState support progressively?
The hashbang URLs are a nuisance. For example: there are always two versions of each URL, e.g.:!/rauschma/status/171801699395178497
If JavaScript is enabled then the former version is rewritten to the latter version after the page has loaded. Traditionally, hashbang URLs were the only way of dynamically updating a URL to reflect the current application state. But with widespread support for pushState [1] that changed a while ago. You now can arbitrarily change a URL, as long as the domain stays the same.

Related reading:

  1. The pushState() method” on MDN