Dear DotNetNuke Developers,
Please help.
How can one hide the Admin bar with JavaScript?
This is kind of what I have so far...
<script type="text/javascript"></p>
window.onload = function () { var my_ControlBar_ControlPanel = document.getElementById("ControlBar_ControlPanel");
if (!my_ControlBar_ControlPanel) { //Continue. The item is "falsey" which means it was NOT found.
//This never hits. alert("test my_ControlBar_ControlPanel 1"); } else { //This always hits. alert("test my_ControlBar_ControlPanel 2"); //This does NOT set the Div vertical space to zero but it does hide the contents of the Div??? my_ControlBar_ControlPanel.style.display = "none"; my_ControlBar_ControlPanel.style.height = "0px"; } };
</script>
...so how can one get that to go away and hide completely?
Please advise.
Note we are using DotNetNuke 8 (sadly not upgraded yet).
I am injecting the JavaScript via an HTML module on the page.
Thanks.
-- Mark Kamoski
...
On a sidenote, I would strongly advise you to upgrade your DNN sites to v9.8 ASAP. DNN 8 has known security vulnerabilities due to old Telerik extensions which have (in my case) let through ransomware attacks earlier this year. There are some newly published resources (refer to the blogs on this site) that will help you identify the DNN extensions that you'll need to remove/update/modify in order to have them working without Telerik installed.
Dear Paras,
I appreciate the advice about upgrading but that is not my issue at the moment, and my customer does NOT want to upgrade yet, so it is a moot point at the moment so....
I really have to solve the problem as stated above, and I would LOVE it if you could offer some way or idea on how to solve THAT problem.
...I can hide the contents of the Admin bar via JavaScript...
...but I cannot hide (set the vertical space to zero) relative to the Admin bar...
...There is a probably a fixed-header setting in CSS somewhere, buried in Bootstrap... Or a fixed margin somewhere... or the like...
But the CSS and related things appear to be a "Big Ball Of Mud" so finding the culprit is proving very hard for me to find the culprit.
Do you have any insight into the solution that seek, relative to the problem I posted above, regarding hiding the Admin bar with Javascript?
All,
Regarding how to hide the ControlBar, I found one workaround temporary had to do it via code-infront markup on the DotNetNuke "ControlBar.ascx" as follows...
...in this file...
\admin\ControlPanel\ControlBar.ascx
...this was the code before the change, and the ControlPanel is visible, shown here...
(LessThanChar) asp:Panel ID="ControlPanel" runat="server" (GreaterThanChar)
...this is the code after the change and the ControlPanel is hidden (for all pages, but I am sure I can hack it to show/hide it conditionally here with C# but I ultimately need JavaScript) here..
(LessThanChar) asp:Panel ID="ControlPanel" runat="server" Visible="false" (GreaterThanChar)
...and YES I know it is generally discouraged practice to change the cord DotNetNuke code, but I have it all in source control, and I need to do something and I cannot find the right JavaScript to do this so...
...if you have a better idea, then please LMK, and the seminal question - (How can one hide the ControlPanel via JavaScript?) - is still "unanswered" so please help if you can.
(Yes, I totally agree, we MUST upgrade, and I am pressing the panic button here, but it is a battle and I am low on the totem pole.)
(Yes, I totally agree, we MUST not had code, but this is a weird case, a small internal-lan-only-site, and even a hack will do for now, and I have full backups, and I have source control, but I need to get the go-ahead to do it.)
I will check out what you all have said so far (and I really do appreciate it a lot) and please send more good ideas if you have them.
I don't get why you do that if you made a single role and assign your customer under this role and give view-only permission to the page your problem will be automatically solved
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.