How do I add a global javascript and css to a whole page that uses a predefined template in Adobe CQ5?

StackOverflow https://stackoverflow.com/questions/22396103

  •  14-06-2023
  •  | 
  •  

質問

I want to Send data via AJax call to serlvet, the serlvet will return some result based to which I will redirect to a page. So where do I add this global .js file i.e the file that contains the AJAX call. PLEASE NOTE I'M USING PREDEFINED FORM COMPONENT AND A PREDEFINED TEMPLATE(Form Template) SO I CAN'T DO STUFF LIKE <cq:include clientLibs> to add .js file, as I don't have source code of component(form template).

I found a link where we add a global JS but I don't have this option in my CQ5 instance. So Weird. http://www.sfu.ca/itservices/cms/howto/advanced/style-a-page/customjavascript.html

enter image description here

役に立ちましたか?

解決

Am not sure of this custom style-sheet and JavaScript section. Might be they would've customized the page properties as i too don't find them in CQ 5.4 / 5.5.

Though you may not be able to include your custom CSS and JS in JSP using <cq:includeClientLibs>, you can make them as part of the clientlibs that is getting included in the form or the page component.

i.e. You can create a cq:clientLibrary folder that has the categories property set to the same value which is being included in the page.

But, it is recommended to be cautious while trying this way, as your JS would be available in all the pages where this client library is included, and hence try to write the script as specific as possible so that it doesn't affect the rest of the functionality.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top