How can I include external js script files in <head> tag of CMS Pages

User132112
Tera Contributor

Hi,

          I am working on a cms portal where I need to reference external js scripts to each page of portal.   It should only be included in all pages of a specific portal but not all portals.

Eg follow two files I need include in <head> tag of each page

<script>https://www.abcdegf.net/assets/jquery.min.js"></script>

<script>https://www.abcdegf.net/assets/js/xyxscripts.1.1.js"></script>

I tried adding above scripts in a content block but it gets added in a table <td> tag eg in <td id="dropzone0" dropzone="true" width="100%">.

I am wondering if there is any way I can above include external js scripts files in <head> tag of all CMS pages.

Any help much appreciated.

3 REPLIES 3

User132112
Tera Contributor

Seems like servicenow does not allow the scripts to put in header unless they are global scripts


HungMiju
Mega Expert

please use:


System UI -> UI Script


create a ui script then put info of javascript into that


you can use in cms


<g:include_script src="name_UISCRIPT.jsdbx" />


Thanks


ChrisBurks
Mega Sage

You can use hungpro's suggestion and place that statement on the layout used on the portal. Then use that layout on the site level or specific page level of your portal.



Or do the same with your own script that you posted. Either one should work.



Or you can write a script to push your script tags to head.