DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Hugo Di Francesco
Hugo Di Francesco

Posted on

Do we still need turbolinks/PJAX?

While messing around with a server-rendered web application, I was thinking of dropping PJAX in to make page changes smoother, but I tested on a couple different browsers and it seems they all fetch the new page in the background and replace it after (like PJAX but with a proper style/JS refresh).

With that in mind: is there still a use case for PJAX/turbolinks?

Top comments (3)

Collapse
 
skatkov profile image
Stanislav(Stas) Katkov

Any references to browser documentation? Would be intetesting to understand differences in technical implementation .

I can just assume, that browser does full page refresh it makes it looks smoother, but not much gain in performance.

With turbolinks you can refresh only part of the page, leaving other things intact (or with minimum changes).

Collapse
 
gmartigny profile image
Guillaume Martigny

Browsers tends to get better and better at rendering pages smoothly. But one thing turbolinks (and such) will always improve is load time.
When you fetch twice the same resource (css, js ...), your browser reload from local cache (disk), but it reloads it anyway (plus parsing and such).
Even better, some lib will preload the target page when the user hover the link. It take a minimum of 100ms for someone to click a link, these time is used to load the next page.
Ever asked yourself why Dev.to is so fast to load ? Take a look at your debugger's network panel and hover any link.

Collapse
 
hugo__df profile image
Hugo Di Francesco Author • Edited on

That makes a lot of sense, it's less about the flash to white of a page navigation and more about performance and responsiveness of the page.

🌚 Life is too short to browse without dark mode