Portrait Dr. Axel Rauschmayer
Dr. Axel Rauschmayer
Homepage | Twitter
Cover of book “Exploring ES6”
Book, exercises, quizzes
(free to read online)
Logo of newsletter “ES.next news”
Newsletter (free)
Cover of book “JavaScript for impatient programmers”
Book (free online)

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:

@danwrong:
plus, now I'm in charge of undoing twitters hashbang URLs I can confirm that all the issues in that article are very real.
@timhaines:
x months from now (when your project completes) Twitter will no longer use hashbangs?
@danwrong:
correct. All gone. It was a mistake for several reasons. PushState or bust.
@timhaines:
You're going to revert to page refreshes if the browser doesn't support PushState? Adding PushState support progressively?
@danwrong:
yep.
The hashbang URLs are a nuisance. For example: there are always two versions of each URL, e.g.:
    https://twitter.com/rauschma/status/171801699395178497
    https://twitter.com/#!/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