[eluser]Michael Wales[/eluser]
I'm still not sure how that makes a difference - without seeing what your JS looked like - sounds to me to be some obtrusive coding. Personally, I'd take a look at my Javascript and figure out why it can't be shared across all pages.
But - if you want, you could do something like this within each controller:
Code:
$data['js_file'] = 'index.js';
Then in your header view:
Code:
script src="<?= base_url(); ?>assets/js/<?= $js_file; ?>" type="text/javascript"
By loading the header and footer from your page specific view you are automatically passing the $data array to those views (without even changing the load->view() method).