Understanding the “data-no-turbolink” Attribute in HTML

Understanding the “data-no-turbolink” Attribute in HTML

Using data-no-turbolink to Customize Navigation


3 min read

In web development, you might encounter situations where you need to control how links or elements behave during navigation. One way to do this is by using the data-no-turbolink attribute in your HTML. In this post, we’ll explore what this attribute does and how you can use it effectively.

TurboLinks is a JavaScript library that enhances the speed of navigating within a web application. It does this by replacing the entire HTML body of a page rather than performing a full page reload when you click on links. While TurboLinks can improve the user experience by making navigation faster, there are times when you may want to override its default behaviour.

The data-no-turbolink attribute is a simple yet powerful tool that allows you to control how TurboLinks handles specific links or elements in your web application. When you include this attribute in an HTML tag, TurboLinks will ignore the link or element when it comes to navigation.

Here’s an example of how to use it:

<a href="/some-page" data-no-turbolink="true">Go to Page <\a>

In this example, clicking on the “Go to Page” link will bypass TurboLinks, and a full page reload will occur. This can be useful when you have links that perform actions or transitions that require a complete page refresh.

You might consider using the data-no-turbolink attribute in the following scenarios:

1. Forms and Submissions: If you have forms that submit data or perform actions that need a full page reload to work correctly, add data-no-turbolink to the form element or submission button.

2. External Links: When linking to external websites, it’s often best to disable TurboLinks to ensure that the user leaves your site entirely when clicking the link.

3. Complex JavaScript Interactions: If you have complex JavaScript interactions that rely on the page being fully reloaded, use data-no-turbolink to control when TurboLinks should not intervene.


1. Faster Page Loads: TurboLinks can significantly reduce page load times by only refreshing the necessary parts of a page, resulting in a smoother user experience.

2. Improved Responsiveness: Users can navigate between pages without waiting for full page reloads, making the application feel more responsive.

3. Bandwidth Efficiency: TurboLinks can save bandwidth by loading only the content that has changed, reducing data transfer.

4. Simplified Development: Developers can create more dynamic web applications with less JavaScript and server-side code, simplifying the development process.

5. Consistency: TurboLinks helps maintain a consistent user interface across different parts of the application.


1. Compatibility Challenges: TurboLinks may not work well with certain JavaScript-heavy libraries and can pose compatibility challenges.

2. Complex Interactions: Applications with complex JavaScript interactions may require workarounds or disabling TurboLinks on specific pages to function correctly.

3. SEO Concerns: Search engine optimization (SEO) can be impacted because search engine crawlers may not interpret TurboLinks navigation correctly.

4. Back Button Behavior: The behavior of the browser’s back button can be less predictable with TurboLinks, as it doesn’t always trigger a full page reload.

5. Resource Intensive: In some cases, TurboLinks can consume more memory and resources in the browser, potentially affecting performance on older devices or browsers.

These pros and cons highlight the trade-offs involved in using TurboLinks in web development. Whether it’s a suitable choice depends on the specific requirements and constraints of your project.


The data-no-turbolink attribute is a valuable tool for web developers working with TurboLinks. It allows you to fine-tune the behavior of specific links or elements, ensuring that your web application functions smoothly and as intended in various scenarios. Whether you need to handle form submissions, external links, or complex JavaScript interactions, data-no-turbolink gives you the control you need to deliver a seamless user experience.

Incorporating this attribute into your HTML code can be a simple yet effective way to improve the functionality and reliability of your web applications.

Did you find this article valuable?

Support MKhalid by becoming a sponsor. Any amount is appreciated!