Turbolinks
suggest changeIntroduction
Turbolinks is a JavaScript library that makes navigating your web application faster. When you follow a link, Turbolinks automatically fetches the page, swaps in its <body>, and merges its <head>, all without incurring the cost of a full page load.
Remarks
As a Rails developer, you will likely interact minimally with Turbolinks during development. It is, however, an important library to be familiar with because it can be the cause of some hard-to-find bugs.
Key takeaways:
- Bind to the
turbolinks:loadevent instead of thedocument.readyevent - Use the
data-turbolinks="false"attribute to disable Turbolinks on a per-link basis. - Use the
data-turbolinks-permanentattribute to persist elements across page loads and to avoid cache-related bugs.
For a more in-depth treatment of Turbolinks, visit the official GitHub repository.
Credit for much of this documentation goes to the folks who drafted the Turbolinks documentation on the GitHub repository.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents