Host an HTML file on SharePoint? Here is the catch.
If you uploaded an .html file to SharePoint and it downloaded instead of opening, or your JavaScript stopped working, you are not doing anything wrong. SharePoint is built to stop exactly that. Here is why it happens and the quickest way to get a working page.
Updated June 2026
Host my HTML page →01 Why SharePoint won't render your HTML
SharePoint is a document and content platform, not a web host for arbitrary HTML. Two of its security defaults get in the way, and neither has a checkbox you can flip:
- HTML files download instead of displaying. When you store an
.htmlfile in a document library, SharePoint Online serves it with a download header. The browser saves the file rather than rendering it as a page. This is a deliberate security choice, so the page you wanted never shows up. - Custom scripts are blocked by default. Microsoft disables custom script on modern SharePoint Online sites. Inline JavaScript and most embedded code is stripped or refused, so any interactive page that depends on its own scripts simply will not run.
The Embed and Script Editor parts that older guides mention are restricted on modern sites, and the File Viewer part shows Office documents and PDFs, not a live HTML page. That is why "can SharePoint host HTML files" keeps coming up: in practice, for a real interactive page, it cannot.
02 The fix: host the page, then point SharePoint at it
Host the HTML on a service whose job is to serve it, get an https URL, and bring that URL back into SharePoint. You keep SharePoint as the place people start from, and the page actually works.
Publish the HTML file
Drop your .html file on yapp.page. If it has CSS, images or JavaScript, drop the whole folder or a ZIP with index.html at the root. You get a live https URL like yourname.yapp.page in about two seconds, with the scripts intact.
Embed or link it in SharePoint
On your SharePoint page, edit it, add the Embed web part, and paste the yapp.page URL (or an <iframe> pointing at it). The page renders inside SharePoint. If embedding is locked down on your tenant, just add a link to the URL instead; it opens the working page in a new tab.
Update without re-uploading
When the content changes, update the page on yapp.page and the URL stays the same, so the SharePoint embed and every shared link keep pointing at the latest version.
03 What about keeping it inside SharePoint?
If your page is genuinely simple, there are limited in-platform options worth knowing:
- Embed web part can show content from sites your admin has allow-listed, but it will not run a raw HTML file from your document library.
- Text and image web parts handle basic formatting, but no custom scripts and no real layout control.
- SharePoint Framework (SPFx) is the supported route for custom code, but it means a developer toolchain and an admin deployment, which is overkill for a single HTML page.
For anything with its own styling or scripts, hosting the page elsewhere and embedding the URL is faster, and it keeps working when SharePoint tightens its script policies again.
04 Frequently asked questions
Can SharePoint host HTML files?
It can store an .html file, but it will not serve it as a live page. SharePoint Online downloads the file instead of rendering it, and custom scripts are off by default. To get a working page you host the HTML elsewhere and link or embed it back into SharePoint.
Why does my HTML file download instead of opening?
SharePoint serves library files with a download header as a security measure, so the browser saves your .html rather than displaying it. There is no library setting that turns the file into a rendered page.
Why isn't my JavaScript running in SharePoint?
Modern SharePoint Online disables custom script by default, so inline and embedded JavaScript is stripped or refused. An interactive page that relies on its own scripts will not work pasted directly into SharePoint.
How do I embed an HTML page in SharePoint?
Host the page over https, then add the Embed web part and paste the page URL or an <iframe> pointing at it. yapp.page gives you that https URL in seconds.
What is the easiest way to host the page outside SharePoint?
Drop the file on yapp.page. You get a live https URL in about two seconds with no account, and you can paste that URL into the Embed web part or share it directly.
Related
Host an HTML file online, free →
A simpler GitHub Pages alternative →
Free static website hosting →
How to publish an HTML website →
Share a PDF online, free →
Set up yapp.page with your AI client →