Insert JavaScript (JS) into your digital workplace to add your own custom functionality.
Visit the Igloo Developers Center for more information.
Sections in this article:
- Who can do this?
- Inline vs. External JS Code
- Testing your JS code
- Where to add JavaScript to your digital workplace
Who can do this?
- Enterprise administrators
- Workplace administrators
- Space administrators (only within their space)
- Digital workplace members with the Edit JS role (only via the Advanced page)
Inline vs. External JS Code
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:
- Go to the file.
- Right-click Download and select Copy link address.
- (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 your JS code
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.