Coming from SharePoint On Premise I have been used to use SharePoint as a host for simple HTML and JS pages. Usually I created a Document Library or Custom List, then browsed to the created folder via webdav and uploaded the files.
On SharePoint Online however, I had a hard time getting this to work. SharePoint would serve the .html file for download instead of serving the content. A common advise at different SharePoint forums is to change the file extension to .aspx. Doing this only caused a “file not found” error.
Solution
After trying out different ways to create/serve the files, I have found that this will work if Allow users to run custom script on self-service created sites is enabled. This is found in the SharePoint Online Administration Center > Settings > Custom Scripts.
After enabling this, I am able to create .aspx files in Document Libraries and List folders and have the content served when browsing to the file. .html files are still served for download.
Added bonus: I am also able to create folders via webdav and serve .aspx AND .html pages from those folders. So .html files created in folders that are created via webdav (and not the SharePoint webinterface) will serve both .aspx and .html content. Neat.
Is this safe
As far as I can tell from this MS article, it is not dangerous to enable this option, but you will loose some audit options as mentioned in this MS article (which also recommends using SharePoint Framework instead – but this will not allow for simple full screen pages – yet).
know of other security concerns that this might raise? Then please let me know in the comments or on Twitter.

One thought on “Host static HTML page on SharePoint Online”-
Pingback: Accessing MS Graph from static HTML page on SharePoint Online – Dennis Vinther Jensen