Search Results page as an IFRAME inside another page

sharepoint_only_logoThere might be scenarios where the search center is configured in a different site collection but the client wants the search results inside the current context. In some cases the search center might not have the required branding.

For those unlikely & awkward scenarios, below is a dirty hack.

Here we edit the actual results page by adding custom CSS & JS codes which will trigger only when the page is opened inside an IFRAME. Then inside the actual site collection, we create a page (searchholder.aspx) & add a CE web part to hold this IFRAME. Here the searchholder.aspx also has to do additional work like passing on the search keyword to the actual results page present inside the IFRAME.


var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(,
sURLVariables = sPageURL.split(‘&’),
for (i = 0; i 0) {
var newheight = jQuery(‘#’+id).contents().find(“#Result”).height();
newheight = newheight + 200;
jQuery(‘#’+id).attr(‘height’, newheight);

jQuery(document).ready(function() {
// Try to change the iframe size every 2 seconds
setInterval(function() {
}, 2000);


Now inside the actual results.aspx add below inside a CE web part:



var isInIframe = (window.location != window.parent.location) ? true : false;
var newHtml = “”;





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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s