1

Im trying to embed a html file, which is hosted in a SharePoint 2016 library, inside of an iframe on a none SharePoint-Site. Currently im getting "sites.sharepoint.com refused to connect". If i try to embed a SharePoint-Site it works just fine.

Things i've tried so far:

Adding sandbox="allow-same-origin" to the iframe.

Central Administration -> Manage web applications -> General Settings -> Browser File Handling changed to "Permissive"

1 Answer 1

0

There is a SPFx webpart (works on modern pages) available on GitHub by Microsoft called react-script-editor. You can install this webpart to your site collection and then use below code to insert the html into an iframe.

<script language="javascript" type="text/javascript">
    $(document).ready(function(){
        $("#iframeContainer").attr("src","https://siteurl/page.html");
     });
</script>

<iframe  id="iframeContainer" src=""></iframe>
1
  • Thanks, but i try to embed the html file in a non sharepoint site.
    – Smaxwell
    Aug 25, 2021 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.