Can I insert scripts in CMS?
No.
As indicated in the FAQ entry on scripts, scripts may not be embedded in CMS pages or uploaded to site file storage.
On many occasions, NDSU-IT has been asked to make exception and allow embedding some Javascript to make a special button or form work. Most of the time, a work-around is available that also fixes accessibility issues that would arise from using the script. Examples follow.
Help Desk - Live Help example
As shown on the Help Desk page, a Live Help button to chat with a Help Desk representative is included in the page. The Help Desk requested for Javascript code be inserted in the page to render the button and link.
The Javascript would have changed the button image based on the availability of Help Desk representatives. With minor depreciated functionality, a single image was inserted into the page as a link. Alt and title text were provided for the image and the link, to make the button accessible.
How to insert a button like this?
- Save the button graphic to your local computer
- Upload the button graphic to CMS in the Filelist module
- Identify what Web address the script would take visitors to. Sometimes, you can click an example link provided by the vendor and copy-paste the address directly. Other times, you may need to view the script source to identify what the address will be.
- In a content element RTE, click the button to insert an image. Select the button graphic
- Click the button graphic and click the button again to add Alternate Text and Title and click OK to apply the changes
- Click the button graphic and click the button to make the button graphic into a link. Choose External URL and enter the address in the URL field. Choose Style = navigation-link to prevent link styles from appearing in this button link, and set the Title to briefly describe the function of the link
For example,
Important: if you use an image for a link as described herein, it is imperative that you provide alt text for the image to maintain accessibility.