I need to hide global search under Manage Communities --> Edit --> Click on Tabs and Pages -->Select standard salesforce tabs --> select chatter tab..When i did this and when i change from Internal to Communities on the header I see the global search box

I think If I hide it for chatter tab it will hide under above specified location.


Try to use the native javascript, it is easier in this case. And then just hide the element with a class name headerSearchContainer:

    window.onload = function(){
        document.getElementsByClassName('headerSearchContainer')[0].style.display = 'none';
  • Except, don't hook into window.onload. Just use addEventListener/attachEvent (for old IE) and use that instead. You may accidentally conflict with a salesforce.com internal library if you use window.onload. – sfdcfox Dec 9 '13 at 20:46
  • @sfdcfox I have had cases (SFDC of course) where jQuery's "ready" function has not worked (conflict with prototype?), but "window.onload" worked just fine. So i prefer this now :) But nice hint about "addEventListener", almost forgot about it! – Sergej Utko Dec 9 '13 at 20:55
  • @mast0r I have added your script to visualforce but still not working – sfdc Dec 9 '13 at 21:06
  • @sf.dev Strange, for me works well... Try to find out the ID of the global search element on you page with a firebug etc (right click on the search field). – Sergej Utko Dec 9 '13 at 21:11
  • 1
    @amatorVitae You can use jQuery for sure, but for this simple case i think it not necessary to load whole library only for hiding one element. – Sergej Utko Dec 9 '13 at 21:38

You can always override the Communities header with your own HTML rather than using the standard HTML, which includes global search. Here is the HTML for adding custom global search box:

<form action="/<community name>/search/SmartSearch" method="get">
    <input id="phSearchInput" type="text" name="str"/>
    <input type="submit" value="Search"/>
  • above html is used for adding the global search box to header But I want to remove search box.I am getting search box on the communities (I have added selected tab as chatter under Manage Communities --> Edit --> Click on Tabs and Pages -->Select standard salesforce tabs --> select chatter tab..When i did this and when i change from Internal to Communities on the header I see the global search box – sfdc Dec 9 '13 at 23:12
  • What I'm saying is that if you add your own HTML to the header, the global search box will disappear. You may want to add it back selectively, hence the HTML sample above. – greenstork Dec 10 '13 at 12:39

I have added blank html file to Documents folder and then updated the header of community under Manage Communities --> Edit Community Name --> Branding -->Header (Upload the html file from document folder) and this has removed the global search from chatter tab

<html lang="en">
  • This is perfect! – rael_kid Aug 18 '17 at 7:28

Go to Customize > Home > Home Page Components and create a new home page component. Give it some name and make the Type as HTML Area and hit next.

Make the component position Narrow (left) column. And paste this in the huge text area below.

<script type="text/javascript">
  document.getElementsByTagName('nav')[0].style.border="1px solid white";
  document.getElementsByClassName('left')[0].style.visibility = 'hidden';
  document.getElementById('phHeaderLogoImage').style.visibility = 'visible';
  document.getElementsByClassName('right')[0].style.visibility = 'hidden';
  document.getElementsByClassName('multiforce')[0].style.visibility = 'visible';
  document.getElementsByTagName('nav')[0].style.borderTopLeftRadius = '.5em';
  document.getElementsByTagName('nav')[0].style.borderTopRightRadius = '.5em';
  document.getElementsByTagName('nav')[0].style.MozBorderRadiusTopleft = '.5em';
  document.getElementsByTagName('nav')[0].style.MozBorderRadiusTopright = '.5em';
  document.getElementsByTagName('nav')[0].style.WebkitBorderTopLeftRadius = '.5em';
  document.getElementsByTagName('nav')[0].style.WebkitBorderTopRightRadius = '.5em';


  #phSearchButton {
     display: none !important;

  #phSearchInput_autoCompleteBoxId .autoCompleteHoverRow {
     display: none !important;

  #phSearchInput_autoCompleteBoxId .footerRow {
     display: none !important;

  #phSearchInput {
     display: none !important;


Apply that custom component to all the styling your org is using.

Hopefully it should help.

  • 1
    Oh I forgot to mention, this method will hide the global search in all the pages, visualforce and standard salesforce pages. – codeinprogress Dec 9 '13 at 21:02
  • @Neeraj.I need to hide it only on one visualforce page – sfdc Dec 9 '13 at 21:03
  • Do you want the header in your visualforce page? If not then you can do showHeader="false", if you want your header then try inserting the style I wrote above in the <style> of your vf page. – codeinprogress Dec 9 '13 at 21:26
  • Requirement got updated.I need to hide it on standard chatter page not elsewhere – sfdc Dec 9 '13 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.