none
“This content cannot be displayed in a frame” - SharePoint online RRS feed

  • Question

  • Hi,

    i am developing such a page where there will be links at the left side and IFrame will on the right side. For the links i am using link list and just adding list view web part on the page along with IFrame. So basically when user click any link related page/document will display inside IFrame.Links could be external web sites link as well internal. now problem is few links getting error on IFrame saying "This Content cannot be displayed in a frame". i tried to modify the master page but not working. where should i put "<WebPartPages:AllowFraming runat="server"  />" as i am using Publishing feature enabled master page. i have added external domains into HTML field Security also.  i am using below code for Iframe as well some css for the list view web part.

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script>
    $(document).ready(function(){  
        setInterval(function() {
    	$("a.ms-draggable").attr("target", "myIframe");
    	},1000)
    });
    </script>
    <style type="text/css">
    iframe {
      border: none;
      width: 100%;
      height: 100%;
    }
    
    @media (min-width: 1024px) {
      .content_viewport {
        border: 0px none;
        height: 900px;
    width: 1200px;
      }
    }
    @media (max-width: 1023px) {
      .content_viewport {
        border: 0px none;
        height: 900px;
    width: 1200px;  }
    }
    @media (min-width: 768px) {
      .content_viewport {
        border: 0px none;
        height: 900px;
    width: 1200px;  }
    }
    
    .ms-webpart-chrome-title {
        vertical-align: middle;
        
        margin-bottom: 2px;
        background-color: #36A9E0;
    }
    
    .ms-webpart-titleText.ms-webpart-titleText, .ms-webpart-titleText > a {
        font-family: "Segoe UI Semilight","Segoe UI Semilight","Segoe UI","Segoe",Tahoma,Helvetica,Arial,sans-serif;
        color: white;
        
        text-align: center;
        text-
        white-space: nowrap;
    }
    .ms-vhltr {
        padding-right: 2px;
        
    }
    .ms-list-itemLink-td {
        width: 30px;
        vertical-align: top;
           
    }
    .s4-itm-selected > .ms-vb-imgFirstCell.ms-vb-imgFirstCell {
        background-color: #0078d4;
        border-right-color: rgba(156, 206, 240, 0.5);
        background-clip: padding-box;
        -webkit-background-clip: padding;
        
    }
    .ms-viewheadertr {
        cursor: default;
        display: none;
    }
    .ms-rteTable-default, .ms-rteTable-default > tbody > tr > td, .ms-rteTable-default > tbody > tr > th, td.ms-rteTable-default, th.ms-rteTable-default, .ms-rtetablecells {
        border: 1px solid #e1e1e1;
    }
    
    
    </style>
    <div style="  margin: 15px auto; max-width: 1200px;"><iframe class="content_viewport" name="myIframe" src="https://www.bing.com/" scrolling="no"></iframe>
    <p>&nbsp;</p>
    </div>


    • Edited by rakib1 Tuesday, February 11, 2020 10:43 PM
    Tuesday, February 11, 2020 9:52 PM

All replies

  • Hi,

    Please try to add the code into a script editor web part to check if it works.

    And check if you have checked in and published the master page.

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, February 12, 2020 7:42 AM
  • Hi,

    Thanks for your reply. FYI, script already running into Script Editor web part and master page published too but same error. As i said i am using SharePoint Online with Classic template with publishing feature and i need to know where should i put this tag "<WebPartPages:AllowFraming runat="server">" into html master page.

    Thanks in advanced!

    Wednesday, February 12, 2020 8:51 PM
  • Hi,

    In html master page, please add the code below into <head/> tag.

    <!--SPM:<WebPartPages:AllowFraming runat="server"/>-->

    Or we can add the code below into .master page directly.

    <WebPartPages:AllowFraming runat="server"/>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, February 13, 2020 8:51 AM
  • No idea, for some reason is not working for me. as you can see below my code but still few external sites does not display on sharepoint page with Iframe.

    Thanks

    Thursday, February 13, 2020 7:17 PM
  • Hi,

    Please add the code below into <head/> tag in .master page directly.

    <WebPartPages:AllowFraming runat="server"/>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Friday, February 14, 2020 1:38 AM
  • Hi,

    i am using SharePoint Designer for editing purpose and there is two files for master page one is html and master page itself. i cannot edit the master page directly as it wouldn't let me do that. so i have placeed "<!--SPM:<WebPartPages:AllowFraming runat="server"/>-->" into html which is reflecting into master page as you can see below picture but still blocking the page into IFrame.

    Thanks for your help.

    HTML Page:

    Master Page:

    Friday, February 14, 2020 3:45 PM