How to enable custom scripts in SharePoint SE (OnPrem) on Modern Design site collections

Matthias68 256 Reputation points
2025-03-21T11:30:04.39+00:00

Is it possible enable custom scripts in SharePoint SE (OnPrem) on Modern Design site collections? In 2019 it was possible for site collections in Classic Design, see https://sharepoint.stackexchange.com/questions/272451/sharepoint-2019-how-do-i-embed-custom-script, and it seems to be possible in SharePoint Online (https://learn.microsoft.com/en-us/sharepoint/allow-or-prevent-custom-script), but how can we do this in SE for Modern Design pages?

Microsoft 365 and Office SharePoint Server Development
0 comments No comments
{count} votes

Accepted answer
  1. Ling Zhou_MSFT 23,620 Reputation points Microsoft External Staff
    2025-03-24T02:23:20.65+00:00

    Hi @Matthias68,

    Thanks for reaching out to us. We are very pleased to assist you.

    Unfortunately, after we enable the custom scripts in SharePoint SE (OnPrem), the Script Editor Web Part and Content Editor Web Part are not available in SharePoint Modern Pages.

    These web parts were part of the classic SharePoint experience and were primarily used in classic SharePoint pages. In the modern SharePoint pages, Microsoft has moved towards a more simplified and secure way of structuring content, and custom scripts aren't allowed directly on these pages.

    Currently, the only way to add custom scripts to Morden experience site collection is to use SPFx.

    If you are new to SPFx, then you can start with this article: SharePoint Framework development with SharePoint Server 2019 and Subscription Edition.

    We also recommend using SPFx, as the “Allow custom scripts” setting will be removed in the near future. Once this is removed, we will not be able to use custom scripts in Classic or Modern Experience and SPFx will replace them as another option for customizing SharePoint.

    User's image

    If you have any questions, please do not hesitate to contact me.

    Moreover, if the issue can be fixed successfully, please click "Accept Answer" so that we can better archive the case and the other community members who are suffering the same issue can benefit from it.

    Your kind contribution is much appreciated.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.