
How to Embed HTML in SharePoint: HTML Pages, the Embed Web Part, and People Outside Your Company
Two ways to put HTML on a SharePoint page in 2026, what each one can and cannot run, and what to do when the people who need the page cannot sign in to your SharePoint.
Short answer: SharePoint now has two ways to show your own HTML. The new HTML pages let you upload an .html file to the Site Pages library and publish it like any other page. The older Embed web part shows another web page inside a modern page through an <iframe>. Both stay inside SharePoint's permissions. If the people who need the page cannot sign in to your company's SharePoint, publish it at a public link instead.
Everything about SharePoint below comes from two Microsoft Support articles, Create, upload, edit, and publish HTML pages in SharePoint and Add content to your page using the Embed web part, checked on 16 October 2026. HTML pages are new and rolling out gradually, so your tenant may not show them yet.

Option 1: upload it as an HTML page
This is the route for a page that is HTML from top to bottom, such as a report, a project status page, or something an AI assistant generated for you.
- On the SharePoint site, select + New, then HTML page, then Upload HTML page. Or go to the Site Pages library, select Create or upload, and choose Upload HTML page or Upload HTML folder.
- Pick the
.htmlfile (or the folder with its images). SharePoint copies images and other files embedded in the HTML into the Site assets folder. - Review the page, then select Publish, and share it with Share.
What you should know before you rely on it:
- No Copilot license is needed to upload, edit text, publish or view. You need a Microsoft 365 Copilot license only to create or change the page through the Copilot chat pane.
- It runs in a sandbox. SharePoint renders the page in a sandboxed iframe with its own Content Security Policy. JavaScript written inside the file runs, but the page cannot make arbitrary
fetchrequests or outbound API calls, and it cannot uselocalStorage. - Libraries are limited to five. Chart.js, Mermaid, React, Fluent UI and Babylon are available from a Microsoft-managed CDN; any other CDN script is not loaded. A page that pulls Tailwind, D3 or a charting library from a public CDN needs rewriting first.
- Links outside SharePoint need the admin's allow list. A link to another domain only opens once a site admin adds that domain under HTML Field Security.
- 10 MB per file, not counting the images and videos SharePoint moves to Site assets.
- Site owners can switch it off per site, with Allow HTML files under the Site Pages library's File types. There is no tenant-wide switch.
Option 2: the Embed web part
The Embed web part is for showing a page that already lives somewhere else, such as a dashboard, a map or a video, inside a modern SharePoint page.
- Edit the page, open the toolbox, select See all web parts, and add Embed
</>. - In Website address or embed code, paste either the page's address (for services that support it) or
<iframe>embed code.
Microsoft lists the common reasons it fails:
- Embed code must be
<iframe>. Code that uses<script>tags is not supported, so you cannot paste a raw HTML snippet here. - HTTPS only.
- The other site has to allow framing. Many sites refuse to be shown in someone else's iframe, and nothing on the SharePoint side changes that.
- Your admin decides which domains are allowed. Under Site settings > HTML Field Security, a site collection admin can block external iframes, allow a specific list of domains, or allow any domain. If yours is blocked you will see "Embedding content from this website isn't allowed."
When the people who need it are outside your company
Both options sit inside SharePoint's permissions. Microsoft's article says publishing an HTML page does not grant new permissions: people open it according to the sharing option you choose. Whether you may share with guests or with anyone who has the link is set by your organization's admins, not by the page.
That is often the deciding factor for an HTML report a client, a supplier or a class needs to see. For that case, put the page at a public link:
| HTML page in SharePoint | A public link (dochost) | |
|---|---|---|
| Who can open it | People the sharing settings allow, usually after signing in | Anyone with the link, no sign-in |
| Scripts from public CDNs | Only five Microsoft-hosted libraries | Any |
fetch and API calls | Blocked | Allowed |
localStorage | Blocked | Works |
| Size | 10 MB per file | 1 MB free, up to 50 MB on paid plans |
| How long it stays up | As long as the site keeps it | 7 days free; permanent on paid plans |
| Sits in your intranet's navigation and permissions | Yes | No |
With dochost you paste the HTML or upload the file and get a link that opens without an account. If the page needs a password, permanent links or your own address, the paid plans cover those. If everyone who needs the page is already in your Microsoft 365 tenant, SharePoint's own HTML page is the better home for it.
FAQ
Can I embed HTML in SharePoint?
Yes, in two ways. Upload the .html file as an HTML page in the Site Pages library, or add an Embed web part and paste <iframe> embed code that points at an HTTPS page. The Embed web part does not accept <script> tags or raw HTML.
Why does my HTML page in SharePoint not load scripts?
SharePoint runs HTML pages in a sandbox that only loads Chart.js, Mermaid, React, Fluent UI and Babylon from a Microsoft-managed CDN. Other CDN scripts, fetch calls, outbound API calls and localStorage are blocked. JavaScript written inside the HTML file itself still runs.
Can people outside my organization see a SharePoint HTML page? Only if your SharePoint sharing settings allow it. Publishing an HTML page does not grant new permissions; viewers get the access of the sharing option you pick, and your admins decide which options exist. To show the page to people with no access to your SharePoint, publish it at a public link instead.
Why does the Embed web part say embedding isn't allowed? Your site collection admin controls which domains can be embedded, under HTML Field Security. Ask them to add the domain. If the domain is allowed and the frame is still blank, the other site is refusing to be framed.
Why don't I see the option to create an HTML page in SharePoint? HTML pages are new and Microsoft is rolling them out gradually, so your tenant may not have them yet. Until + New → HTML page appears on your site, the Embed web part is the only built-in route, and it needs the page to already live at an HTTPS address.
Why does an HTML file in a SharePoint document library download instead of opening?
A plain .html file stored in a document library is treated as a file, not a page, so SharePoint offers it as a download rather than rendering it. To have it open as a page, upload it through Site Pages → Create or upload → Upload HTML page, or publish it at a link and show that link with the Embed web part.
Can I paste raw HTML code or <script> tags directly into a modern SharePoint page?
No. Modern SharePoint pages do not include the classic Script Editor or Content Editor web parts, and the modern Embed web part rejects <script> tags and raw HTML snippets. Either upload a complete .html file as a SharePoint HTML page, or host the HTML at an HTTPS URL and embed it with an <iframe>.
How do I embed an interactive HTML report or dashboard in SharePoint?
If everyone viewing the report has SharePoint access and the file only uses inline JavaScript or Microsoft's five allowed libraries (Chart.js, Mermaid, React, Fluent UI, Babylon), upload it under Site Pages → Upload HTML page. If the report uses other CDNs, fetch calls, or external viewers need access without signing in, publish the single HTML file to an HTTPS link on dochost and either share the link directly or embed it in SharePoint's Embed web part (once your admin allows the domain in HTML Field Security).
Bottom line: keep internal pages inside SharePoint, where HTML pages and the Embed web part respect your permissions; send the page as a public link when the people who need it are outside your company or the page needs scripts SharePoint's sandbox blocks.
Author
Founder of dochost (Xhorizon Labs LLC). Software engineer focused on web publishing, HTML and Markdown rendering pipelines, sandboxed content delivery, and AI developer workflows.
Categories
More Posts

Do AI Share Links Expire? ChatGPT, Claude and Gemini Compared
ChatGPT, Claude and Gemini share links have no expiry date, but each one dies a different way: deleting the chat, unpublishing, auto-delete or an admin switch. Here is what keeps each link alive, what kills it, and whether readers see later edits.

CodePen vs dochost: Where Should AI-Generated HTML Live?
CodePen is an editor with a shareable result, while dochost turns finished HTML from ChatGPT or Claude into a clean link that opens as the page itself.

How to Share a Formatted Document Without Sending an Attachment
Attachments break formatting, trigger download warnings, and die on phones — here's how to put a Markdown or HTML document at a link instead.
Newsletter
Join the community
Subscribe to our newsletter for the latest news and updates