Jun 14 2019 01:40 AM
Hi
how do i add HTML code and JavaScript to SharePoint online
Jun 17 2019 06:48 AM
@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
Jun 17 2019 07:51 AM
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.
Jun 17 2019 08:06 AM - edited Jun 17 2019 08:20 AM
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
Jun 17 2019 08:13 AM
@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 :grinning_face:
Mar 02 2023 10:21 AM
@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
Mar 02 2023 12:49 PM - edited Mar 02 2023 12:50 PM
What do you want to accomplish in terms of tab UX and what happens when you click them. First evaluate existing web parys in SharePoint Online. Next look at open source samples at https://pnp.github.io/sp-dev-fx-webparts/. As a last resort maybe the script editor web part (part of the samples).
All part of ROI.