Hacker News new | past | comments | ask | show | jobs | submit login

Rails 4 uses turbolinks. It is a mechanism that instead of loading a new page loads up the HTML via AJAX and replaces the entire content of the page without reloading all the resources(css, js, etc...)

So instead of having to deal with plenty of small ajax calls you just build an app as it would work in plain HTML and just use turbolinks to leverage AJAX.




Funny that ASP.NET had the same thing, called Smart Navigation, back in 2003.


2003 or 2013, ASP or Rails both are terrible ideas IHMO. At least as a default.

Sure it can be very efficient, but it's a terrible default.

When DHH state: > except, maybe, compatibility issues with some existing JavaScript packages

Some ? Don't you mean most ? Even Twitter Bootstrap will leak memory if used in a turbolink app.

When coffeescript is pushed as default, I'm ok, at worst you don't use it and you have a useless gem. But turbolink is harmful if you don't know what you are doing.


Much further after that, there was a jQuery plugin called taconite that let you do this from arbitrary languages. The idea was that you can handle all of your templating server side and build the template into a simple xml document that had tags corresponding to jquery dom manipulation functions. You return the template with the right mimetype, and the plugin handles translating your xml template into a dom update. This has been handy a few times to keep all of the display logic centralized in a single templating mechanism.


TurboLink does less, so there are less things to screw up.

TurboLink always replace the whole body, not just part of the page. There's no input focus to maintain. Server side render a page the same regardless of whether it's fetched normally or through TurboLink. Links fallback correctly on JS-disabled client.


smart navigation is very different. Besides not being supported across browsers, it was more like automatic anchoring.


Nope, it's not automatic anchoring. It uses JS (iframe AJAX) to retrieve a new page from the server and display it without flicker.


But if two pages have the same resource URLs for their css, js, etc they should be cached by the browser so moving from page to page shouldn't be reloading them.

This does not seem like a super great idea, like merry-christmas mentioned too much like ASP.NET.

I'll do some reading on turbolinks and see if there's something super I'm missing.


I did some speed tests here: https://github.com/steveklabnik/turbolinks_test

Apparently, even though the browser doesn't re-download the assets, it does re-parse and re-execute all of it. Which makes sense. This is where Turbolinks adds the speedup.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: