how to hide portal header when opened in navpage

alper
Kilo Contributor

Hi everyone,

Is there any way to hide portal header when it is opened in navpage? Also Customer wants to keep it hidden in all pages when opened in navpage. But in the SP, header should be displayed. I searched it, couldn't find any solution yet.

Any help will be appreciated. Thanks in advance.

dgs.PNG

1 ACCEPTED SOLUTION

Bryan Tay3
Mega Guru

hi Alper,



I think you can achieve this by editing the OOTB stock header.


1. Navigate to "Headers & Footers" -> Stock Header.


2. Click clone widget.


3. Modify the widget client script to check if it is in iframe, hide the top menu bar if it is.


        HTML:


                  <div id="stock_header_id">


                      <nav class="navbar-inverse" ng-class="::{'navbar':!isViewNative, 'is-native': isViewNative}"


                            ...


        Client Script (add to the bottom):


                  //if inside an iframe


                  if((window.self !== window.top))


                  {


                            var header_element = document.getElementById('stock_header_id');


                            header_element.hide();


                    }


4. set the new cloned widget as the theme stock header.


        Themes -> Stock -> Header.



I tried it and it is working on my instance.



cheers.


View solution in original post

2 REPLIES 2

Bryan Tay3
Mega Guru

hi Alper,



I think you can achieve this by editing the OOTB stock header.


1. Navigate to "Headers & Footers" -> Stock Header.


2. Click clone widget.


3. Modify the widget client script to check if it is in iframe, hide the top menu bar if it is.


        HTML:


                  <div id="stock_header_id">


                      <nav class="navbar-inverse" ng-class="::{'navbar':!isViewNative, 'is-native': isViewNative}"


                            ...


        Client Script (add to the bottom):


                  //if inside an iframe


                  if((window.self !== window.top))


                  {


                            var header_element = document.getElementById('stock_header_id');


                            header_element.hide();


                    }


4. set the new cloned widget as the theme stock header.


        Themes -> Stock -> Header.



I tried it and it is working on my instance.



cheers.


alper
Kilo Contributor

thank you Bryan, It works but in console, it gives an error. the code below doesn't give any error.



Client Script:


if((window.self !== window.top))                   { jQuery('#stock_header_id').hide(); }