SharePoint hosted app part is not loaded with error “Refused to display <App URL> in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'”

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/104938

Question

I am working on a SharePoint hosted app. It runs fine when loaded by clicking on the app icon in Site Contents page. But when I add it to a page with client web part, it is stuck on the 'Working on it' loading message. The message logged in console says "SharePoint hosted app part is not loaded with error "Refused to display in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'"

is the url of the app. It is usually on a different domain like "https://tenant-89b6750c1b31e3.sharepoint.com/sites/dev/...".

The app contains nothing. Just a very new app.

Also, I tried to figure out whether it is a server issue or page issue. I created an auto-hosted app for that. And the same way I added a client web part and added to the same page. And it works. As I believe the auto-hosted apps also run from different domain ( somewhere in Azure ).

So, why won't the SharePoint hosted app run?

The difference I could locate is that - Auto hosted app runs from Azure website, while SharePoint hosted runs from some SharePoint hosted sub web under same tenant.

Had anyone faced the same issue, and resolved? How?

Was it helpful?

Solution

Add the following to the app page you want to display in an app part:

<WebPartPages:AllowFraming ID="AllowFraming" runat="server" />
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top