Forum Discussion
Injecting javascript into SharePoint online communication site
RomanRomych Depending on what you are trying to do, it's likely not supported. Modern Pages do not support the same DOM injection that we used to use in classic. To run JavaScript on your modern pages, you would indeed have to build an SPFx extension.
However, if you build an SPFx extension that is used to change out of the box components such as web parts, sections, navigation, etc... this would be unsupported, so be careful doing so.
Beau Cameron Thanks
So we cannot really add much custom scripts into modern sharepoint? ![]()
- Beau CameronDec 08, 2020MVP
RomanRomych Correct. As mentioned, you can use SPFx Application Customizers, but you shouldn't inject JavaScript to customize out of the box components. It's only supported to inject code into pre-defined placeholders on the page (top and bottom).