Lurker News
http://instantclick.io/

It seems the internet architecture won't bring us instant websites anytime soon. So here is a hack.
I released this JS library last month (today is version 2.0 release, fixing v1.0's rough edges), it makes use of HTML5's pushState and preloading to make a website instant.
It works like this: before clicking on a link, you'll hover over it. And there's a delay of 200-300 ms between these two events. InstantClick uses this delay to preload a page, when you click on a link it will display instantly in most case. (You can test on the website.)
That's similar to pjax and Turbolinks, for it uses HTML5's pushState and Ajax. And preloading is thrown into the mix.
In case preloading all the links that a user hover over is too much work for the server, there's also an option to set a delay before preloading kicks in, or to preload on "mousedown". Mousedown is when you press your mouse button (a click is when you release it). This way you still get a slight "magical" speed advantage, and pjax's benefits (notably, no recalculation of scripts/styles on every page change).
For mobile it preloads on touchstart, so you get 400 ms to preload. This is different from FastClick: with InstantClick a user can still double tap to zoom without triggering a link.
As said in the first sentence, the internet architecture can't bring us instant websites today or tomorrow. So I think this — InstantClick — could be a pretty big thing to improve the situation at scale.
The main challenge I see is that existing JS scripts may not work with it out of the box. I don't do much web development nowadays though, so I don't know how big of a problem that is, and I don't know if there isn't any other major barrier in the way to make this mainstream.
That's why I'm awaiting your opinion, smart folks of HN.

Comments (174) 47 threads

Earlier comments
lmartel1 reply#
This is very cool!

One interesting reaction I had: things loaded so fast that I didn't notice one of the page changes and thought it was stuck. For sites like this one where different pages look very similar, maybe it could be worth experimenting with some sort of brief flashing animation (to make it look like a real page load)?

dieulot#
Yes, I was thinking about something in the like of NProgress: http://ricostacruz.com/nprogress/ If the page is displayed instantly, show a complete bar that disappears. (I’m not sure if that would solve the problem, I may explore different solutions.)
ishener4 replies#
i still don't understand why in 2014 it's not possible to have an entire website with all it's files zipped and shipped as it is on the first request. how wasteful is it to have 50 requests for a server just for images and resources? have your root domain be a zip file of everything you need to view it, and then include some additional popular pages along with it. it can't get any faster than that
crimsonalucard#
Cached resources can actually make it faster then the packaged model you described.

For example I go to site A which uses jquery from the google cdn then I switch to site B which uses the same cdn. The browser doesn't even make a request for the jquery resource then, it just loads the cache. If the full site was loaded as a zip file we'd be downloading redundant jquery data twice.

pornel#
It's coming. That's what HTTP/2 PUSH is for.
userbinator#
> how wasteful is it to have 50 requests for a server just for images and resources?

On the other hand, how wasteful is it to download tons of content that would be useless because the user might've navigated away from your site already?

p4bl01 reply#
I'm not sure it's working for me, I don't see any special network activities in Firebug while using the website.

Also, you should take into account the focus event of links, I tried and it seems you doesn't when trying on the "click test" page to tab tab tab on the test link and then hitting enter.

dieulot1 reply#
Focus isn’t used a lot, so it’s not worth the extra complexity in code.
p4bl0#
I don't know how instantClick is implemented, but to me attaching some callback to a second event is not added complexity, it's just a few duplicated lines of "administrative" code.

Load more comments