SharePoint Search Scope Drop Down List - Remove "This Site:"
In my Publishing portal, I have created 3 Search Scopes and configured the Search Settings to display the search results in Search Center (/Search/results.aspx).
It worked fine for all three scopes with no issues, but the problem is with the uninvited scope “This Site ”. This is a contextual scope (Default Scope) which always included to the scope dropdown by default out of our notice. There is no UI Setting/Configs to change this behavior. This Contextual scope always displays the search results to the ooSearchresults.aspx page which I don’t want.
This unwanted scope (“This Site ”) can be removed by injecting the following JavaScript to the master page.
<script type="text/javascript">
function SearchScDDLInj()
{
var srhScDDL = document.getElementById("ctl00$PlaceHolderSearchArea$ctl01$SBScopesDDL");
srhSpDDL.remove(0);
}
SearchScDDLInj();
</script>
Thanks!
3 comments:
If you use jquery, you can also use this shorter code to remove the option:
<script type="text/javascript">
$("#ctl00_PlaceHolderSearchArea_ctl01_SBScopesDDL option[value='This Site']").remove();
</script>
This is not working at all. I have tried this putting into master page but no luck at all,,,,
Bavin,
check out whether the DDL control ID is matching.
Post a Comment