This content cannot be displayed in a frame

This is the error I received when I tried to insert my newly created SharePoint App in a web page.

The solution was to include the following tag into the aspx page which was mapped with the Client Web Part.

<WebPartPages:AllowFraming runat="server"/>

This is done because, SharePoint adds X-FRAME-OPTIONS: SAMEORIGIN in the HTTP response header which, in a page, will allow framing from the current domain only, blocking all the other external sites. More details can be found here.

To overcome this, we need to explicitly enable the AllowFraming option in the corresponding pages as, by its very design, App code does not reside on the same server as SharePoint.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.