Here are tools for that ordered by their coolness:
- dns-prefetch - execute domain resolution in background
- preconnect - execute domain resolution plus tcp handshake, plus executes TLS handshake for SSL
- prefetch - fetches resource in background. Resource is fetched with a lower priority, and only after common resources load is finished. Prefetched content is stored in cache.
- subresource - prefetch analogue with higher priority
- prerender - the coolest thing, prefetches resource, executes all css and js for it in background, and displays extremely fast rendered page on demand.
Let's say user is browsing through paginated posts, and he currently stays on page one. From our side we can suppose that user will want to view also page two, so we decide to prefetch it:
And considering that prefetch also works with cross origin resources we can imagine how a lot of cool things can be done using it.
All these five tools a really great.