How do I add a hyperlink in one HTML file to another HTML file?

yosa 40 Reputation points
2024-07-10T01:54:38.3833333+00:00

I have a Documents folder, which is of the Document Library type. Inside, I have a temp folder that includes two HTML files: a.html and b.html. In the a.html file, there's a link to the b.html file (B file). When I open the a.html file using an HTML viewer and click on the B file hyperlink, I receive a "404 NOT FOUND" notification. I also tried using the absolute path without success. I know that I can use Pages in the Page library, but this solution doesn't help me enough. I want to use SharePoint as the place where I will add my HTML reports, minimizing the effort required.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,229 questions
0 comments No comments
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2024-07-10T07:10:31.5333333+00:00

    Hi @yosa,

    SharePoint Online tenants handles the file open experience using the strict model. As a result, all files which can potentially cause harm (e.g. a html file having embedded script) are not executed in the browser but downloaded or shown as raw content (html preview in the modern user experience).

    For these html/html files the remediation is simple: if a user/app with site owner or site collection admin permissions renames the html/htm files to ASPX files then these files do open again. Below SharePoint PnP PowerShell shows a how this can be done.

    Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/permissive -Verbose
    Rename-PnPFile -ServerRelativeUrl /sites/permissive/html/newfile.html -TargetFileName newfile.aspx -OverwriteIfAlreadyExists
    
    
    

    Here is the document for reference

    https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting

    After rename then html files, you will need to allow custom script to enable aspx file. Please follow the steps in the document

    https://learn.microsoft.com/en-us/sharepoint/allow-or-prevent-custom-script


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.