SharePoint Iframe 報錯“此內容不能顯示在一個架構中”<續>

來源:互聯網
上載者:User

標籤:des   style   class   blog   code   http   

  在之前的SharePoint網站iframe引用中,我們遇到過下面的問題,就是其它系統或者不通環境的SharePoint網站,引用SharePoint頁面會報錯“此內容不能顯示在一個架構中”,之前我們採取瞭解決方案的辦法。

  今天,無意中翻看msdn,發現了更加簡便的方法,分享給大家。

原理介紹

  在大部分情況下,如果網頁在響應中發送 X-Frame-Options HTTP 頭,則該網頁將無法在架構中顯示。預設情況下,SharePoint 網頁包含 X-Frame-Options 頭。如果使用應用程式 Web 承載的 SharePoint 網頁,您可能會遇到以下錯誤(如所示):"此內容無法在架構中顯示"。

This content cannot be displayed in a frame
To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame.
What you can try:Open this content in a new window

  請記住,當網頁在架構中顯示時,特定方案易受"點擊劫持"攻擊。請仔細評估您的應用程式組件方案,以確保不存在點擊劫持攻擊風險。

  如果在應用程式 Web 中承載的頁面不易受點擊劫持攻擊,則您可以使用 AllowFraming Web 組件抑制頁面響應中的 X-Frame-Options 頭。下面的程式碼範例展示如何在 SharePoint 頁面中使用 AllowFraming Web 組件。

  <webpartpages:allowframing id="AllowFraming1" runat="server"/>

 

解決方案

  使用SharePoint Designer開啟該頁面(特別的,修改的是要被iframe方式引用的頁面)的頁面配置,加入如代碼:

  特別要說的是,WebPartId會自動產生,不需要我們手動添加;

  再次開啟頁面,發現iframe的頁面顯示正常了,不再報錯,如:

參考連結

http://www.cnblogs.com/jianyus/p/3385514.html

http://msdn.microsoft.com/ZH-CN/library/office/fp179921(v=office.15).aspx

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.