We have a Rails application where we are including our application dependencies in the html head within application.js
:
//= require jquery
//= requi
It has a cool solution. Make js loading correctly for your application. Here, I am loading jQuery first then loading analytics.js . I hope this will solve your problem for html5 supported browsers. Code:
var fileList =[
'your_file_path/jQuery.js',
'your_file_path/analytics.js'
];
fileList.forEach(function(src) {
var script = document.createElement('script');
script.src = src;
script.async = false;
document.head.appendChild(script);
});
This code snippet will load jQuery first and then load analytics.js file. Hopefully, this will fix your issue.