How can we help you today?

How to Apply Custom JavaScript on a Modern SharePoint Site

If you have some JavaScript code that you need to apply across your entire SharePoint Site Collection, you can easily do so using the Custom JavaScript feature in ShortPoint Theme Builder. Follow the steps below to learn how.


Theme Builder


TABLE OF CONTENTS


Prerequisites


Interactive Tutorial

Start the interactive tutorial to learn how to add JavaScript code using Theme Builder:


NOTEYou can only use the first option if you have ShortPoint Shortcuts enabled. To learn more about it, check out Introducing ShortPoint Dashboard and Theme Builder Quick Access.

Step-by-step Tutorial

Follow the steps to add JavaScript codes in Theme Builder:


Step 1: Open Theme Builder


There are two ways to open Theme Builder. Choose the option that suits your needs.


Option 1: Using ShortPoint Icon

You can only use the first option if you have ShortPoint Shortcuts enabled. To learn more about it, check out Introducing ShortPoint Dashboard and Theme Builder Quick Access.


  • Go to the ShortPoint site you want to use and click the ShortPoint icon:


ShortPoint icon


  • Select Theme Builder:

Theme Builder


Option 2: Using Site Contents

This option opens Theme Builder using Site Contents


  • Go to the ShortPoint site you want to use and click the cogwheel icon:


cogwheel icon

  • Select Site Contents:


site contents

  • Open the ShortPoint Dashboard:


ShortPoint Dashboard


  • Click Theme Builder:


Theme Builder

  • Select Customize my site:


Customize my site


Step 2: Open Custom JavaScript

  • Go to Utilities:


Utilities

  • Select Custom JavaScript:


Custom JavaScript


Step 3: Add JavaScript Code

  • Paste your JavaScript code in the field provided:


paste JavaScript

  • Click Apply:


Apply

  • Publish your changes.


That's it! You can now add JavaScript codes.


Authorizing External Scripts


If you will be loading JavaScript from external sources, you must add the source domain to the Trusted Script Sources list in your SharePoint Admin Center. This step is required to ensure the script runs correctly under SharePoint's Content Security Policy (CSP).


For detailed instructions, please follow the "How to Add Trusted Source URLs" section in our Managing Trusted Script Sources for JavaScript Customizations in ShortPoint article.


Related articles:

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

World's best intranet sites are designed using ShortPoint

Get started today! Learn more
See all 15 topics

Start a trial

Ignite your vision. Install ShortPoint directly on your site, or play in sandbox mode. No credit card required.

Get started today

World’s best intranet sites are designed using ShortPoint

Thousands of companies using ShortPoint everyday to design, brand and build award winning intranet sites.

Get started Learn more