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:

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s