For the number of years, I have been doing SharePoint development by injecting JavaScript in Content Editor web part. My question is: With SharePoint Online Modern Experience, this practice is impossible and the only way to develop, even for the smallest modifications, is through the SharePoint Framework?


For modern SharePoint Sites, you can use the Modern Script Editor web part.

It is developed by community members and works the same as the Content Editor web part.

Get the source code from below.

Modern Script Editor Web Part

Follow the steps mentioned in the README and you will be able to add the web part in your modern SharePoint Page.

Once the web part is added you can put your javascript in that.


Yes, you have to use SharePoint Framework(SPFx) to add javascript for Modern experience.

You can create SPFx webpart and add javascript. This JS will be applicable only the pages where you insert this webpart.

Or you can create an Application Customizer SPFx extension where you can add javascript, by this way it will be applicable for all of the pages. You can check below documentation for sample:
How to create SPFx Application Customizer extension

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.