I have a page which loads several scripts and I want to improve performance by delaying loading these scripts until the document is ready.
I implemented it with jQuery's getScript and it works, but I added logging of the result of script loading and turns out in a small percent of visits some of the external scripts fail to load. Now these scripts are essential for the page, so if they are not loaded then menus won't work and stuff.
I wonder if loading these scripts the conventional way via a static script tag (<script src="..."></script>
), that is letting the browser do it is more reliable than doing it dynamically via getScript. I don't think there should be a difference, but I thought I'd ask.
Does the browser do the better job or is it all the same and these kind of script loading errors happen with the static script tag too, so getScript is as good as the script tag?
(I know it is the browser that does the downloading in both cases, the question is about the script tag vs getScript.)