Chapter 21 Turbolinks

Turbolinks is a JavaScript library that, when enabled, attaches a click handler to all links of an HTML page. When a link is clicked, Turbolinks will execute an Ajax request, and replace the contents of the current page with the response’s <body> tag.

When Turbolinks is activated, it uses the HTML5 History API to dynamically change the address of the current page, enabling users to bookmark a specific page and use the back button as they normally would.

The biggest advantage of Turbolinks is that it enables the user’s browser to only fetch the required stylesheets, JavaScripts, and even images once to render the page. Turbolinks effectively makes your site appear faster and more responsive.

Turbolinks is automatically included ...

Get The Rails 5 Way, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.