如何在单击后退和前进按钮时停止rails和javascript执行两次此图像src?
Rails代码 - application.html.erb
<%= javascript_include_tag 'application', 'data-turbolinks-track':
'reload' %>**
js code - aa.js
$(document).on('turbolinks:before-cache', function(event) {
console.log("aastik");
var scp = document.createElement('script');
scp.setAttribute('src',''); //image https:// src
scp.async = true;
document.head.appendChild(scp);
});
rails - secure.html.erb
<span id="siteseal">
<script async type="text/javascript"
src="/javascripts/aa.js">
</script>
</span>