I’m more or less building a new design into some software and to retain the functionality of some of the page features I need to keep some of the javascript files the system uses; however it appears the software uses a global header to include all the .js files and to cut down on http requests I was only wanting to include them when the page actually needed them.
However without actually pining through the code of each page, is there a quicker method you can use to test if the page actually needs to have a certain .js file included or not!?
There is no reliable way to test that. A better solution would be to pack all javascript files in a single file, so it needs only a single request.
During that packing you may minimize them as well (remove comments and unneeded whitespace). You can cache the packed file, so it doesn’t have to be generated on each request. If you pass the proper headers, the browser will cache it as well, saving you bandwidth and speeding up the page.