-4

I have two adserver javascript codes that must be loaded in the head section of our website. The first needs to load only on frontpage and the second needs to load only on other pages. I use a Joomla! platform and Easy Scripts plugin to add javascript codes to head section. The problem is that this plugin is loaded on the entire website and I'm not able to make it load only on a specific page. Please, help me!

Sorry for the lack of details. Here are the codes:

<!--START of script to be loaded everywhere-->

<script type="text/javascript" src="//ro.adocean.pl/files/js/ado.js"></script>
<script type="text/javascript">
    if(typeof ado!=="object"){ado={};ado.config=ado.preview=ado.placement=ado.master=ado.slave=function(){};} 
    ado.config({mode: "old", xml: false, characterEncoding: true});
    ado.preview({enabled: true, emiter: "ro.adocean.pl", id: "xxxxxxxxxxxxxxxxxxxxxxxxxxx"});
</script>
<!--END of script to be loaded everywhere-->


<!--START of script to be loaded only on frontpage-->
<script type="text/javascript">
ado.master({id: 'yyyyyyyyyyyyyyyyyyyyyyyyy', server: 'ro.adocean.pl' });
</script>
<!-- END of script to be loaded only on frontpage-->

<!--START of script to be loaded only on otherpages-->
<script type="text/javascript">
ado.master({id: 'zzzzzzzzzzzzzzzzzzzzzzzz', server: 'ro.adocean.pl' });
</script>
<!--END of script to be loaded only on otherpages-->
Ciprian Pap
  • 17
  • 1
  • 8
  • Describe it in a more concrete way, what type of application you have. What you mean by load only in frontpage. Ask something like: I have here my html files, and here scripts, and how to load first script in first page, etc. – amol01 Mar 31 '16 at 13:48

1 Answers1

0

You can use something like modulesanywhere ( https://www.nonumber.nl/extensions/modulesanywhere ) & sourcer ( https://www.nonumber.nl/extensions/sourcerer ) to 1) define where it loads and 2) the other to include php. With those two things you can use the native Joomla functions like addScriptDeclaration ( https://docs.joomla.org/Adding_JavaScript ) to add the script's code to the head.

cybersholt
  • 96
  • 1
  • 5