Turbolinks

Download ruby-on-rails eBook

Introduction

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 your 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:load event instead of the document.ready event
  • Use the data-turbolinks-false attribute to disable turbolink functionality on a per-link basis.
  • Use the data-turbolinks-permanent attribute 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.

Related Examples

Stats

48 Contributors: 1
Friday, March 3, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook