PDA

View Full Version : Combining multiple javascript calls in header



gus
01-13-2009, 09:31 PM
I have numerous pages on several sites with multiple javascript calls that reference external javascripts (meaning not appearing on the same page). I've tried to find info about combining multiple js references, but for some reason, clear info about how to do this is not readily found.

If anyone can point me in the right direction, I'm grateful.

Nile
01-13-2009, 10:53 PM
I don't understand what you mean.

You cannot include more than one js file in an src tag. (if that's what you mean)...

gus
01-14-2009, 12:06 AM
No, I don't mean to put them within one src. I was thinking there must be another way to include multiple .js references in a single html call, for example with semicolons separating the src's? I thought I'd seen that done before.

diltony
01-14-2009, 06:00 AM
I havent seen that anywhere before - however if your question is how to purely include multiple javascript reference.....that would be more straight forward.
The only closest thing to that in my library will be

<script language="javascript" src="jscript.php?script1.js;scrip2.js;www.google.com/js1.js;www.yahoo.com/js2.js"></script>

In this case, the call is made through a php script which will simply download the specified urls, concatenate them and output the whole script like a single javascript file, and outputs them with the header('content-type:application/x-javascript');

I am wondering if that is what you are looking for?

gus
01-14-2009, 08:01 PM
Yes, that could be it, and thanks sincerely for your time.

Falkon303
01-16-2009, 02:04 AM
Please don't forget that some people ask to include recognition for their scripts in comments. These need to be called independently to respect the programmer's wishes.

jscheuer1
01-16-2009, 07:01 AM
Please don't forget that some people ask to include recognition for their scripts in comments. These need to be called independently to respect the programmer's wishes.

Not really. A script credit or credits may be placed in the page's source code independent of any script call(s).

Falkon303
02-04-2009, 11:20 PM
Not really. A script credit or credits may be placed in the page's source code independent of any script call(s).

SO good to know! I'll keep em by the scripts only because when it said "do not edit" my paranoid brain considered location a factor as well. :eek:

hah!

- Ben