ensure js files are loaded before header and footer