Answered by:
display sharepoint page in iframe

Question
-
<iframe src="
http://appsrv/pfa/_api/ProjectData/Projects?$select=ProjectName,ProjectStartDate,ProjectPercentCompleted"></iframe>
that link should open SharePoint in my domain , but the error is in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
even I changed permissive-x-frame-option to active
but nothing !
how should I do that?
Thursday, November 12, 2015 6:11 PM
Answers
-
Hi Mehrdad,
Please add the following code into your page:
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <WebPartPages:AllowFraming runat="server"/>
Similar threads for your reference:
http://usamawahabkhan.blogspot.com/2013/05/x-frame-options-to-sameorigin.html
Thanks,
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.- Proposed as answer by Victoria Xia Wednesday, November 25, 2015 8:35 AM
- Marked as answer by Victoria Xia Friday, November 27, 2015 8:25 AM
Tuesday, November 17, 2015 1:57 AM
All replies
-
Hi Mehrdad,
Please use a SharePoint .aspx page into the src instead of SharePoint REST API. For example, you can create a test wiki page named Test in your SharePoint site, then use it:
<iframe src="http://sharepointserver/sitepage/Test.aspx">test</iframe>
In addition, by default SharePoint will prevent its pages to be displayed in iFrame, however adding the AllowFraming will disable the cross-site check and will allow to access through iFrame. You can add the AllowFraming in SharePoint master page, if you want to view all pages, or a specific page.
More information about displaying a SharePoint page in iframe, you can refer to:
https://sharepointking.wordpress.com/2013/07/24/allow-sharepoint-2013-site-to-load-in-iframe/
Thanks,
Wendy
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.Friday, November 13, 2015 2:45 AM -
thanks for your answer but :
Iframe to rest is for get XML data from web service how can I achieve that?
- Edited by Mehrdad javidi Friday, November 13, 2015 7:25 AM
Friday, November 13, 2015 7:20 AM -
Hi Mehrdad,
Please add the following code into your page:
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <WebPartPages:AllowFraming runat="server"/>
Similar threads for your reference:
http://usamawahabkhan.blogspot.com/2013/05/x-frame-options-to-sameorigin.html
Thanks,
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.- Proposed as answer by Victoria Xia Wednesday, November 25, 2015 8:35 AM
- Marked as answer by Victoria Xia Friday, November 27, 2015 8:25 AM
Tuesday, November 17, 2015 1:57 AM