Running Kentico 12 Portal Engine. I'm trying to restrict some JavaScript files (3rd party tracking scripts like Facebooks or Twitter) from loading/displaying when in Edit Mode. It seems all these 3rd party scripts take long to load and definitely not necessary while in edit mode.
My master pages and page templates are all ASCX layout type (not HTML type).
I only found solutions for HTML macros (Example HTML macro: {% if(ViewMode == "LiveSite"){ %} My Restricted Content {% } |(identity)GlobalAdministrator%}) and wonder if there is anything like this for ASCX.
I used <% CMSContext.ViewMode %> but I get this error: "'CMS.DocumentEngine.CMSContext' is inaccessible due to its protection level".
I found a solution to my problem. I the widget Visibility, add this macro: {% PortalContext.ViewMode == "LiveSite" #%}
Based on "Restrict Kentico Content in Edit Mode": https://kenticode.com/restrict-kentico-content-in-edit-mode/
Please, sign in to be able to submit a new answer.