Forum Discussion
Open HTML files in browser - SharePoint Online
I'm trying to open HTML files that are saved in a Document Library created on a Team site (using Office 365 Groups). When we add HTML files to the library they will only download and then open. We would like to be able to have these files open in the browser. Any ideas?
- AaronMiMicrosoft
Here's the document that addresses the issue:
https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting- MothraMoonCopper Contributor
AaronMi Thanks. Even if I had a PhD from MIT to be able to perform this (yes, or watching a video would help), I do not have the administrative priviliges necessary to execute this. Nor will my IT department help me. They either don't know how to do it themselves, or they refuse to help, believing that my needs are too trivial to bother with. Hence the workaround where I literally cut and paste a page at a time into wiki pages and redirected every single link by hand.
I was just hoping that there was a simple "switch" to set to "permissive" being that I created these simple pages myself, and -- while not a luddite by any stretch -- am not up to creating malware which will blow up the internet.
Just hoping that before the powers that be decide to pull the rug out from under me again, I can simply "migrate" my files rather than rebuild them one at a time. After all, I thought technology was supposed to make things easier for lowly peons like me....not so much anymore.
However, I will keep a copy of this.
- SchelleTCopper Contributor
I am having the same problems. I have some scenarios built in eLearning which are simple html5 files, and I want staff to be able to simply click on the index file to open.
Has ANYONE found a simple NON technical way of doing this?
Thanks
Schelle
- bobchurchillCopper Contributor
Only Microsoft could make it so insanely complicated that there are 3 pages of technical answers here, spread over six years, and still no easily applicable solution. And the problem we are having is effectively: how to view files that were intended for the internet, *on the internet*, in this internet-based office system?!
Does the "365" stand for how many degrees of unnecessary complexity there are?- tabishrazaCopper ContributorThe thread started in 2017. Someone cracked a joke in 2022. And here I am in 2024, still trying to figure out how to open an internet file on the internet in this internet-based office system. At this point, I’m convinced “365” is the number of years it’ll take to solve this. 😅
- victormonasterioCopper Contributor
Melissa Klug I have done this. I uploaded the html files to a document library.
Then I used sharepoint designer to access this document library and renamed all the html extension to aspx. If there is references with some html files to other html files sharepointdesigner will rename these references when changing the file extension to aspx. In fact, I uploaded an entire html site to document library, about 160 pages and had it working within sharepoint in 20 minutes.
- SchelleTCopper Contributor
Hi Victor,
I am so sorry to ask, but where is SharePoint Designer?
I have screen shot the menu in SharePoint (attached) and the only thing is Design Manager, what am I missing
- victormonasterioCopper Contributor
SchelleT Sharepoint designer is a separate application. You can download here https://www.microsoft.com/en-au/download/details.aspx?id=35491
- Have you tried to show the file using a content editor webpart (classic sites)
- Melissa KlugCopper Contributor
We have and that works but one of our users has a library with over 30 html files that he would like to be able to click on in the library and then just open in the browser instead of having to set up a page for each one.
- Deleted
I've run into this before and one fix that we came up with -- rename the file extensions from .htm or .html to .aspx. The files will then open in the browser as you expect them to.
- TimHoelskenCopper Contributor
Hello Melissa Klug,
I know this thread is a little bit older, but I stumbled over this while looking for a solution for the same issue. With several try and errors, I finally got a solution that might help you.
What you will need, is a tenant admin and a bit of PowerShell code. So let me describe the few steps necessary:
1) Login to your SharePoint Tenant via SharePoint Online Management Shell with
Connect-SPOService
2) Execute
Set-SPOSite -Identity https://[yourtenant].sharepoint.com/[siteurl] -DenyAddAndCustomizePages 0
After this execution, you will get the Content Editor WebPart available in the WebPart Section and you will be able to include your HTML page inside a Default aspx page of SharePoint.
While I was still experiencing the Problem, that I cannot navigate to a html page inside a library, I was able to create a folder on the root of the site when connecting via SharePoint Designer. After placing a html file here, I was able to navigate to it. Since I did some try and error in advance, you may need to enable the publishing feature too, but I cannot tell if this is really necessary.
Cheers, Tim
-- Updated... now with Format
- MareeACopper Contributor
Melissa Klug I've just joined to look for a solution to exactly the same problem.
i've had a small win using File Viewer to show a html5 page.
I uploaded the html file that i wanted to show into a Documents folder, and then set up a new site page with a File Viewer web part. When the page is published, the html file opens fine in the File Viewer window. The hyperlinks (to external links) in the html page are active and seem to pop out and open up with a normal browser. I haven't tried it yet to open another html file in the same doc folder though.
- Chinthana RathnayakeCopper Contributor
Melissa Klug Try to give some more permission like adding to Owners group or site collection admin. This solved my problem. Thanks
- KuBra9000Copper Contributor
For those of us who are still onpremise.
Add the html mime type to the WebApplication in SharePoint and use a document library in classic mode. Not sure if Microsoft let's you do this in SharePoint Online.You can use the script to add any mime type.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue$webApp = https://yoursitename.com
function Add-SPAllowedInlineDownloadedMimeType{
[CmdLetBinding()]
param(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeLine=$true)]
[Microsoft.SharePoint.PowerShell.SPWebApplicationPipeBind]$WebApplication,
[Parameter(Mandatory=$true, Position=1)]
[string]$MimeType
)
process{
$actualWebApp = $WebApplication.Read()
if ($actualWebApp.AllowedInlineDownloadedMimeTypes -notcontains $mimetype)
{
Write-Host "Adding MIME Type..."
$actualWebApp.AllowedInlineDownloadedMimeTypes.Add($mimetype)
$actualWebApp.Update()
Write-Host "Done."
} Else {
Write-Host -ForegroundColor Green "MIME type is already added."
}
}
}
Add-SPAllowedInlineDownloadedMimeType -WebApplication $webApp -MimeType "text/html"
- tjd1000Copper Contributor
Hello - I also had this issue and the workaround I came up with is uploading all html assets with the index.html to a document library, then opening the file library contents in "Open with Explorer" mode on SharePoint, open the index.html from here and you will notice a different address in the address bar, use this link instead and it will work! Melissa Klug
- Kim RushbrookeCopper Contributor
Thanks Melissa, will give it a go.
- leomm20Copper Contributor
My solution was to modify the img src in each html file, pointing it to the complete url path (https://company.sharepoint...../image1.png).
When you open the html file with the sharepoint's viewer, you have to allow use of 3rd party cookies if you're using Chrome (I had no trouble in Edge).
Cheers!