Forum Discussion
How to add HTML to sharePoint online
Hi
how do i add HTML code and JavaScript to SharePoint online
6 Replies
- Thomas BermanIron Contributor
If you're on classic pages, you can add a Content Editor Web Part which points to your HTML file, which in turn loads your JavaScript files.You can:
- Create an SPFx web part that does what you need
- Create an SPFx single part app page that does what you need
-
Use Mikael Svenson's SPFx Script Editor web part: https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-script-editor- Mikael SvensonIron Contributor
Thomas Berman wrote:
If you're on classic pages, you can add a Content Editor Web Part which points to your HTML file, which in turn loads your JavaScript files.
On modern pages, you can:
- Create an SPFx web part that does what you need
- Create an SPFx full page application
- Use Mikael Svenson's SPFx Script Editor web part: https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-script-editor
The proper way is to create a new SPFx webpart with the html/script. There are many security reasons why using my web part or the the old classic ones are a bad idea.
Just to be clear before you go any which way just because you can 😀
- Gladys AguileraCopper Contributor
Mikael Svenson Hi I am trying to add a tab menu on my SP page, on Modern SP, do I need to do all this just to add that? below
On modern pages, you can:
- Create an SPFx web part that does what you need
- Create an SPFx full page application
- Use @Mikael Svenson's SPFx Script Editor web part: https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-script-editor
- EliMarCopper Contributor
Seems difficult and didn't work with the suggested ways. But somewhere, I found a solution which worked very well: Upload all the files and folders used in the html site to a SP library, keeping the same structure. Open the startpage in an editor > save it as .aspx file > upload this .aspx to the SP library in the folder where you have the .html file. The .aspx can be opened from SP and the links will be ok.
- Djavan ROABrass Contributor
Molete depending on what you're trying to achieve they may be several options. I strongly advice you to go through SharePoint development overview documentation to get a better picture of what is possible https://docs.microsoft.com/en-us/sharepoint/dev/general-development/sharepoint-development-overview