View Full Version : Resolved Calling Javascript not in head

04-07-2012, 02:41 PM
I am hoping someone might be able to offer their thoughts on a problem I have. I need to call a javascript that should reside in the head of the page. Unfortunately I am locked into only being able to build mods. This means no <head> access. Is there a way to dock the script somewhere else and then call it in the mod? Any solutions or ideas would be helpful.


04-07-2012, 08:25 PM
<script> tags work anywhere in the document, but loading order is important. For example:
<script src="my_script.js"></script>
<script> var A = new my_script(); </script>works fine. However,
<script> var A = new my_script(); </script>
<script src="my_script.js"></script>won't - your "my_script" hasn't loaded yet when you try to use it.

So, to answer your question, "maybe." Couldn't say without knowing the specifics of your situation.

04-08-2012, 12:04 AM
Thanks for the response. You always seem to be the one to answer my noob questions traq, so thanks for that :)

I basically have an html mod that I need to put a jquery call or another javascript call into. However reading the installation instructions, they all say "insert call in the head of the doc." Sorry if this sounds like a stupid question, but can I call head javascripts from the body instead?

04-08-2012, 12:17 AM

again, without knowing the particulars I couldn't say. Try it and find out (just make a backup copy of your pages/scripts first).

04-13-2012, 01:54 AM
Calling from the body worked for this thanks. :)

04-13-2012, 04:24 AM
no prob

If your question has been answered, please mark your thread "resolved":
On your original post (post #1), click [edit], then click [go advanced]. In the "thread prefix" box, select "Resolved". Click [save changes].