Clicking "back" in the browser disables my javascript code if I'm using Turbolinks in Rails

Patrik Thorsson picture Patrik Thorsson · Jun 10, 2013 · Viewed 10k times · Source

Well, as the title says more or less. I'm using the gem Turbolinks in my Rails application and I'm having a bit of a problem with the "browser back"-button. My javascripts works fine until i click back in my browser, then it stops working. If I click a link in my app or reload the page it starts working again.

Ant ideas how to fix this?

Answer

UT KU picture UT KU · Jul 5, 2016

The jquery-turbolinks gem doesn't support Turbolinks 5 anymore, so that solution is deprecated right now.

If you'd like to disable turbolinks-caching, just add this meta to your page;

<meta name="turbolinks-cache-control" content="no-cache">