Adding JavaScript to your digital workplace

Insert JavaScript (JS) into your digital workplace to add your own custom functionality.

For more information about using JS in your digital workplace, go to the Igloo Developers Center.

Sections in this article:

Who can do this

  • Workplace administrators
  • Enterprise administrators
  • Space administrators (only within their space)
  • Members of groups with the Edit JS role (only via the Advanced page)

Inline vs. External

Avoid placing your JS inline; instead, reference it as an external file. One way to do this is to upload your code to a folder channel in your digital workplace, and then insert a reference to that file where you want your JS to run. To get this file's URL:

  1. Go to the file.
  2. Right-click the download button, and select Copy link address.
  3. (Optional) Remove the domain from the copied URL.

A reference to a JS file in your workplace would look similar to this:

<script src="/download/my_folder/helloworldjs;v1?attachment=1" type="text/javascript"></script>

Testing

Before deploying your JS to your digital workplace, test it in your digital workplace preview. Should anything go wrong, there will be no impact on other members of your digital workplace.

Where to add JavaScript to your digital workplace

Where you place your JS is determined by where you want it to run:

  • JS should run on every page of a digital workplace: Place your JS in your in the  Code View of your digital workplace's Footer.
  • JS should only run within a space: Place your JS in the Code View of the Space's Footer.
  • JS should only run on a page or channel: Place your JS in the JavaScript Code section on the Advanced page of a page or channel.