$(document).ready() on my page, because jquery isn't loaded (the scripts are injected into the footer by some template or other). I'm stumped on how to address this. I have one page where I want to run a function that is in a script, but the script is loaded last. If I make a case for moving the script(s) into the
<head> I will need to make a compelling argument for it.
I've looked at the current code and every page runs a bunch of methods after the scripts are declared in the footer, which each check that they're on the relevant page and if so they execute. So it will run for example
Historically I can maybe understand why, because downloading tons of scripts blocks the page loading. But these days I cannot understand why this is an issue.
- Scripts are tiny and load very fast.
- Once the script is loaded, it doesn't download it again (unless it changes) as the server simply asks the webserver if the file has changed.
If I have to put calls to run my desired code in the footer, possibly via some complex callback mechanism then really the scripts aren't being loaded in the footer at all and I just have two bodies.
I wonder if anyone could shed some light on this, and explain if I am misguided, missing something, if there's more to it, etc.