21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 644 Views |
-
position on javascript within the <body>

15 August 2011 at 5:23pm
Hi,
I have a site which includes google adverts. To place the adverts on the page, you have to put javascript within the body, on the page where you want it.
However, silverstripe then dumps all the javascript stuff directly after this google adsense script. This is causing a problem with the facebook connect module in IE6 becuase it tries to reload the page while the containing element isn't loaded and closed off.
How would I put some javascript on the page, and keep the rest right at the end of document...
-
Re: position on javascript within the <body>

15 August 2011 at 9:20pm
If you put the script on the page using a plain <script ...> tag instead of the SS <% require %> then SS will not move you script.
-
Re: position on javascript within the <body>

15 August 2011 at 9:55pm
that's what I have:
the javascript is:
<script type="text/javascript"><!--
google_ad_client = "123123123123123";
google_ad_slot = "12312312313123";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>this is in my template. SS is then dumping all the other javacript files linked in using <% require javascript() %> just after my google adsense code. If I remove the google adsense the other javacscript stuff goes back to being at the bottom of the html....
-
Re: position on javascript within the <body>

15 August 2011 at 10:00pm
example here: http://www.munromap.co.uk/
-
Re: position on javascript within the <body>

16 August 2011 at 8:36pm
Yes this is how Requirements is designed to work.
-
Re: position on javascript within the <body>

16 August 2011 at 10:11pm
hmm, that seems a wee bit odd to me! So, if i want to have some script on the page - and also some right at the end of the html, I can't use <% require %> ??
The problem is actually with the facebookConnect module - this adds custom javascript which HAS to be at the very end of the html - otherwise it causes massive problems in IE6 - (eg, it just fails to load anything on the page and i get a white blank page and error message)
I've got it working just now by taking the javascript out of the facebook connect module, and writing it directly into the bottom of my main page.ss template file...
| 644 Views | ||
|
Page:
1
|
Go to Top |


