In the classic site one could link a html file via the content link on the content editor webpart, as seen in the screenshot below-

enter image description here

How can one do the same on a modern site? I tried adding the Modern Script Editor Webpart but then you can't link an HTML file to it.

Any help on this matter would be greatly appreciated!

  • Are you using modern experience or classic experience in SharePoint online?... If you are using modern experience then there is no way to add HTML like we used to add in content editor web part... If you are using classic experience then you can add it to content editor web part. – Ganesh Sanap Mar 23 '19 at 6:30

You need scripts to read the code from text file and then render the code as the html.

As a workaround, you can change the file extension to .aspx to let it be a aspx file. And then render the file using iframe with Embed modern web part or your custom script web part.

For example:

<iframe  name="test" height="120" width="600" src="https://<tenant>.sharepoint.com/sites/<site>/<library>/test.aspx"></iframe>
| improve this answer | |

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.