I have an external javascript file that relies on the presence of another file.
How can I, using JavaScript (or jQuery) automatically include this file if it is not already included (I can test based on the presence of a known function in this external file)
Edit:
It now includes the file but writes over everything completey!
I have tried all suggested methods put forward so far
Well if that JavaScript file defines a specific variable (or a function) you can check its presence by checking
typeof that_variable, then load the JavaScript file if necessary. An example, here is how you load swfobject library if its not available on the page: