Monday

How to Make "This Site" default in Search Dropdown

I had a scenario, where we need to make "This Site" as default Option in Search DropDown. I searched net for solution but with no luck. Finally I have to write my own solution and thought of helping others by writing this Blog:

Step 1: Open the site in sharepoint designer, navigate to the master page and add the following JavaScript in the Head Tag

script type="text/javascript"
function removeOption(checkChar) {
var x = document.getElementById("ctl00_PlaceHolderSearchArea_ctl01_SBScopesDDL");
for (i = 0 ; i < selectedindex="i;">
Now go to the Body tag and add the following:

body scroll="yes" onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') { _spBodyOnLoadWrapper(); removeOption(':'); }"

You can also make it default without writing the Javascript i.e. editing 12 Hive. But if you have multiple sites then all the sites will get impacted with this Javscript. And Also most of the time, Admins doesn't allow to edit 12 Hive.
So above is the best solution.

Thanks
Srikanth Kothakanti
MCP/MCTS SharePoint Architect/Trainer/Principal Consultant