Highlighted

cant load /apps/appname/components/structure/page/x.js in AEM publsher.

JakeCham

01-11-2019

I have an external js file.i called it in main.html like <script type="text/javascript" src="/apps/appname/components/structure/page/x.js"></script>.But cant load it  in AEM publsher.In AEM author it is loading to the related js file.Purpose of doing this is I have a java script code for eloqua form submission which is inside main.html.Because of eloqua js is inside main.html as internal js it is affecting to page loading time.So i have to put that js as an external and call.Either this way <div data-sly-use.page="${'x.js'}"/> is not working because eloqua js is returning nothing.

Replies

Highlighted

Arun_Patidar

MVP

01-11-2019

Please use proxy clientlibs and include using etc./Clientlibs/

check Using Client-Side Libraries

Highlighted

JakeCham

03-11-2019

I put it under /etc/designs/app/clientlibs and check.but it is showing an error which is _elqQ is not defined.Eloqua.js is calling this Library.//img.en25.com/i/elqCfg.min.js.So that can we get eloqua js outside from main.html ? error is _elqQ is not defined.Note - in this case it is not under apps. so allowproxy:false is okay cas it is not under apps.

Highlighted

Umesh_Sondhi

MVP

14-11-2019

Please try following steps:

  •     Create a separate javascript file for eloqua script containing the code
  •     Call the above file using dependencies attribute into your clientlib folder

    1855186_pastedImage_2.png

   

Hope it helps!