Twitter to move away from Hashbangs
storify.com
storify.com
From the recent tweets by https://twitter.com/danwrong it looks like Twitter are moving entirely to HTML5 pushState, and leaving IE users with full page refreshes rather than continuing to serve them #! - Dan says "I'm not sure why everyone is so adverse to page refreshes these days. You can make them fast too."
Of course, Twitter are going to have to include a piece of JavaScript on the http://twitter.com/ homepage which checks for a #! and redirects the user to the corresponding page - and they'll have to keep that JavaScript there forever, since they have nearly two years worth of links that they need to avoid breaking. One of the many reasons #! is such a nasty hack.
In terms of performance, this is going to make Twitter a lot /faster/ for me - I often open Twitter profile pages in new windows (due to working on Lanyrd) and each new window has to pull in and execute a HUGE chunk of JavaScript before it will display the page. Being able to just load a regular HTML page will be much faster for me.
Most sites these day (including Facebook, Gmail, etc) have to execute "a huge chuck of js" before displaying the page.
I have been told by some people in the know that they have come up with a system similar to pjax for certain page components, though that may have changed.
By way of comparison, view the following two links in a javascript-less browser (or just view source):
$ w3m http://twitter.com/#!/danwrong/status/171680703824662528
$ w3m https://plus.google.com/117377434815709898403/posts/f35f8QvHab7
The first link contains nothing but boilerplate and the JS that lazily loads the real content, whereas the second contains the actual content ready for the client to render immediately (and index, if you're a crawler).This is a good move by Twitter. I wholeheartedly endorse it.
They'd just serve the exact same (static) html for every twitter.com/username URL. I don't think it's exactly terrible Javascript hackery to look at the location.href and do an ajax call.
They'd probably support web crawlers with the same system they use now. And many web crawlers these days execute javascript anyway.
A page with a single tweet on really shouldn't need to pull down much code. The JS can all be cached by the browser (far future expires headers etc) and there are some neat tricks you can do with app cache and localStorage to make that work even better.
At the moment if you go to https://twitter.com/#!/twitter then it loads up the HTML for https://twitter.com/, if you're logged in it will be the tweets of those you follow. Then the javascript magic loads in @twitter's profile dynamically.
PushState will allow twitter to load in the static HTML for @twitter's profile at https://twitter.com/twitter/ and then progressively enhance it with javascript. The net gain will be that the page will be available much faster on initial page load.
Twitter is sending down the home timeline as HTML. In fact, what most people are looking for when they go to twitter.com is their home timeline so I'm correct, this is what they are doing (at least in new-new-twitter which I think almost everyone now has). You're also correct, when you go to twitter.com/#!/n8agrin you get your timeline in the background which is then replaced with my tweets. However it wasn't always this way. At one point in time, going to twitter.com just downloaded a bunch of javascript and an HTML bootstrap. The whole site was generated by javascript. I know this because I worked on it.
Technically pushState doesn't really have anything to do with the practice of progressive enhancement or making anything "much faster". You can make pure javascript sites very fast, you can make serving straight up HTML very fast, you can progressively enhance HTML without pushState. pushState is really just a way to manipulate the history of a browser, while optionally changing the browser's current url, without a page refresh (read more here: https://developer.mozilla.org/en/DOM/Manipulating_the_browse...). You can use it to do a lot of things, one of which is to have it serve as one part of a solution for sites that behave like single-page apps without having to resort to the fragment identifier (http://en.wikipedia.org/wiki/Fragment_identifier), forever vilified as the hashbang.
The linked blog post only contains some relatively meaningless Twitter messages and the hyperlink as text, not as an actual link.
One of the things the post doesn't mention (it's sort of implicit in "going under the radar") is that with hash bangs, every request has double the round trip time to retrieve the initial data being displayed, as the server cannot know what data the client wants to retrieve. This makes a lot of nifty performance optimizations impossible.
Why? With proper caching, all you need is the new content. Which possibly entails a few KB of HTML boilerplate and a few milliseconds for the browser to render it, but the round trip is the lengthy part and you get that either way. The only thing hashbangs get you is a prettier transition.
The actual news here is that Twitter is moving away from them, which is very new and welcome news. That link is only useful for general background on the hashbang argument; it's otherwise irrelevant.
Edit: wouldn't it be awesome if Google (they did start this, afterall) would allow sites using hashbangs to auto-update all indexed URls
they constantly had problems with their redesign and the last update involved removing the hashbangs
I believe there were further tweaks for additional pages that needed to be supported (whereas I had only solved, and most likely not very elegantly, the rudimentary issue) that took additional time before the hash bang removal was actually launched.
I check the site every couple of weeks because I was interested in how the redesign would work out. It seems they eventually got it right, I like it. A lot of the other blogs have home and article pages that are just too heavy and slow.
Where content is the main purpose ("websites"), they are overkill at best.
They can be useful though in functionality-first applications ("apps"), where the interface can be costly to build (too slow if you reload the whole "page" on each state change). Ideally, the app differentiates between fundamental states, represented in URLs, and transient states, represented in hashbangs.
Anyway, this is good news for Twitter, if they are really going through with it.
Apparently you can't log into Twitter without 64MiB of RAM, which is what Midori uses. Dillo and Links2 use 6MiB.
Hopefully this means they're switching to a more normal HTML interface and will become a web site instead of a DHTML application again.
EDIT: And based on their implementation, I wouldn't trust anything their engineers have to say about hashbangs either.
Back works as expected - it takes you to the previous page you were at. Fragment identifiers don't break the back button. That's all from a user perspective's point of view, which is mostly all that matters in the end.
If you look at this from a technical standpoint, then back is a refresh of twitter.com, yes.
GET / HTTP/1.1
And never knows what content the client is trying to access, until the client retrieves and processes client-side javascript. Then the client can request further information from the server. The theory is that you can make a "single-page" web-app that loads all of the javascript at once. Then went state needs to be updated, you can do it all from javascript. In practice, it didn't work as well.http://isolani.co.uk/blog/javascript/BreakingTheWebWithHashB... is a great article.
So now, Twitter wants to get rid of the hashbang from its URLs because of— in part— the first reason, and it's currently dealing with the second.
Hope that explained a bit.
If I had to guess, primary reason would be that server is blind as to what page needs to be loaded when you click twitter.com/#!something and an ajax request actually serves the relevant content, so it's relatively slower. Twitter's implementation was particularly slower.
[1]https://developers.google.com/webmasters/ajax-crawling/docs/...
Search engines have provided new scheme for
indexing hashbang URLs with Ajax content[1].
This is a myth.First of all there is no standard and Google has no way of knowing if a website's implementation of hashbang URLs behaves in the expected manner, or not.
Then, you've got all those other issues ... with hashbangs you have no standard way of telling Google some content moved (302, 303) or is not available anymore (404).
Therefore they have to make tweaks for individual websites (akin to how Microsoft was pushing "special" fixes for various popular software running on Windows that broke on updates).
Telling people that hashbang URLs are indexed is exactly the same as telling them that Flash content is indexed ... sure it is. But unless you're too popular for Google to ignore, then get ready for a world of pain.
This is a myth.
First of all there is no standard and Google has no way of knowing if a website's implementation of hashbang URLs behaves in the expected manner, or not.
https://developers.google.com/webmasters/ajax-crawling/docs/...However you are probably right on everything else.
The sample the pros and cons of hashbangs, refer to the discussion on this page: http://ask.metafilter.com/187222/Whats-wrong-with-using-hash...
Comments/Corrections are welcome.
Just as useful, but can be styled separately. Evolved hashtags, backwards compatible.
Hence, might as well make it a user-manageable item in the tweet itself.
And for my money, the reason they wrap every link through t.co is because this way they have analytics on every link clicked on Twitter. That sounds pretty valuable to me.
Second, the hashtags (as well as the @replies) both grew organically out of the userbase. They adopted them because the users had already adopted the hashtags. In fact, if I remember correctly, they were initially resistant to the idea until they saw how much people took to them and used them even without any official support.
The new tab seems like a glorified search - they use a hashtag for an icon, but it seems like the system itself would work pretty well for any single-word search. And with a data firehose as fast as Twitter's, you don't really want to have to do search over multiple words if you can avoid it.
Us nerds, we won't care one way or the other anyway.
HTML templates + AJAX on the client and a REST/JSON API that you can reuse for iOS apps on the backend?
Rolls eyes I don't need Twitter (140 characters should be enough for any application!) telling me how "fast" their pages load. Particularly coming from the notorious fail whale.