SharePoint 2013 Search Center In Iframe

While placing the search center URL in Iframe , we got the following issue known issue(cross domain issue. )
  • Chrome Console error

  • IE Error message

To fix this issue we need to do the following steps.

  • Add this line in you custom Master Page.
<meta http-equiv="X-Frame-Options" content="allow" />
  • Add the following line your layout page. The following tells SharePoint to allow this page to be hosted in an IFrame
<WebPartPages:AllowFraming runat="server" />

After done with the above changes you will face one more issue in IE, i.e. when you click the search vertical, Unfortunately, init.js throws an exception in this context (as it tries to access window.frameElement, which belongs to the other domain). MSDN mentioned same issue.

To fix this issue you need to override the existing code using the monkey patch in JavaScript as discussed in this post.

To fix this issue either you can place the below mentioned code in Script Editor or placed JavaScript file reference in your layout page.

You can download the github Gists

Popular posts from this blog

SharePoint RPC Protocols Examples Using OWSSVR.DLL

STS CryptographicException Error : Key set does not exist

Query suggestions in SP 2013 Using Rest API (/_api/search/suggest)