Fixing javascript issue with turbolinks and safari