Monthly Archives: December 2013

Quick Tip: Change Search Result Page Client Side

One of the major limitation of the OOTB search navigation is that it is scoped to the web level. Not ideal for multiple subsites. Not practical for multiple site collections. So I was tasked with creating my own search navigation that was consistent across site collections.

All of the sites used the same master page so consistency wasn’t an issue. The challenge was changing the results page of the search box when the user clicks a different navigation element. Here’s how I did it.


<script>

EnsureScriptFunc('Search.ClientControls.js', 'Srch.U', function () {
   var boxId = $('#SearchBox').parent().attr('id');

   if (!boxId)
     return;

  var url = '/search/pages/myresults.aspx';
  var srchBox = $find(boxId);
  if (srchBox) {
    srchBox.set_resultsPageAddress(url);
  }

});

</script>

Office Web Apps ‘You don’t have access to this page’

Recently I had a request to show display a document in an iframe using Office Web Apps in SharePoint 2013. Pretty straightforward. In fact, Office Web Apps makes this easy. If you click the File tab in the ribbon > Share > and Embed the iframe html is right there for you.The iframe src attribute will look something like ‘http://yoursite/_layouts/15/WopiFrame.aspx?sourcedoc=blahblah&action=embedview.’ Sweet!

The Problem

I used the code as is and thing worked great…I thought. Randomly I would get a message stating “Sorry, you don’t have access to this page.”

Continue reading