Turbolinks & File Downloads

Posted 7 months ago by wyatt44

Happy News Years everyone!

Ran into an issue today while experimenting with Turbolinks and thought I would share for future searchers.

If using turbolinks and using links to prompt the user to download a file, make sure you disable turbolinks for that link. If your don't turbolinks will pre-fetch that "page" and try to read your file into the body tag.

<a href="url" class="block" data-turbolinks="false">Download</a>

Reference: https://github.com/turbolinks/turbolinks#disabling-turbolinks-on-specific-links

Please sign in or create an account to participate in this conversation.