Log in

View Full Version : Where to place Javascript call? Headinclude causes header to not load properly


abouthere
10-08-2009, 07:03 AM
Hi all,

I'm struggling with a customising issue since I am still pretty wet behind the ears when it comes to vBulletin (I'm a long term PHPBB user who has converted).

I have World of Warcraft character link javascript that I'd like to use. It's designed to work on any site, you simply upload the relevant files and add the following code:
<script type="text/javascript" src="wowarmory_tooltip/js/wat.js.php" />

Once the code is in place, you add a BBCode and it just works.

Now, from what I've gathered, I'm assuming I put this in at the end of the headinclude file on a per template basis. I did this and the roll over worked fine for me; however there was a strange side effect.

- whilst on the index page, half the header doesn't load
- whilst on some pages the header does load

I can't work out why. Am I injecting the Javascript in the wrong place? Or is it more likely to be that the script is conflicting with vBulletin functionality?

Thanks in advance for any replies.

Lynne
10-08-2009, 02:09 PM
Do you get any errors (like in the browser console)? How about the source code - is the header all in the page source and just not showing up in the browser?

abouthere
10-08-2009, 02:26 PM
Thank you for coming back to me, I will check and look at the areas you've mentioned and post some results.

--------------- Added 1255015932 at 1255015932 ---------------

Ok, I opened the page source and straight away saw that Firefox was marking the "/" at the end of my command in red.

Red isn't good, so I looked at how vBulletin scripts are details and used the same format, i.e.

<script type="text/javascript" src="wowarmory_tooltip/js/wat.js.php"></script>

At the moment, it all seems to work!