I have an issue with a script only working when refreshing the page and so I'm trying to disable Turbolinks for only that page. The code below doesn't work. However, if I add the "data-no-turbolink" attribute directly to the body tag in application.html.erb it works. How do I disable Turbolinks in my view? I have followed the solution posted here, Rails 4: disable Turbolinks in a specific page but I can't get it to work.
I have the gem 'jquery-turbolinks' installed.
policy.html.erb
<% content_for :body do %>
<% if controller.controller_name == 'pages' && controller.action_name == 'policy' %>
<body data-no-turbolink="true">
<% end %>
<% end %>
<div class="row">
<div class="small-12 medium-8 large-7 columns end">
<a href="//www.com/" class="nostyle" title="Policy">Policy</a>
<script>(function (w,d) {var loader = function () {var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src = "//cdn.java.com/java.js"; tag.parentNode.insertBefore(s,tag);}; if(w.addEventListener){w.addEventListener("load", loader, false);}else if(w.attachEvent){w.attachEvent("onload", loader);}else{w.onload = loader;}})(window, document);
</script>
</div>
</div>