In CQ / AEM, can I prevent Sidekick from being displayed?

Under certain circumstances, I want to prevent Sidekick from showing on the page. I have tried something:

  • Enable uninstall init.jsp. This works, but it also prevents some JavaScript CQ libraries from being loaded and I need those libraries.
  • Adding jquery onload event to hide sidekick.

    $(function() {CQ.WCM.getSidekick().hide()});

    It doesn't work because the sidekick hasn't loaded yet.

  • Adding jquery load event with timeout.

    $(function() {
      setTimeout(function() {
      }, 1)

    But this is unreliable. Setting the timeout too low will have a high chance of failure. Setting it too high will cause it to appear and then disappear, which is unacceptable.

Please, help!


source to share

1 answer

There are various ways to achieve this.

If you want the sidekick not available on all pages, just comment out the following code snippet available in init.jsp file

CQ.WCM.launchSidekick("<%= xssAPI.getValidHref(currentPage.getPath()) %>", {
    propsDialog: "<%= dlgPath == null ? "" : xssAPI.getValidHref(dlgPath) %>",
    locked: <%= currentPage.isLocked() %>


If you want the sidekick to be unavailable only under certain conditions, you can listen to the event sidekickready

generated by CQ.WCM as shown below and then hide the sidekick.

    var top = CQ.WCM.getTopWindow();
    if (top.CQ.WCM.isSidekickReady()) {
    } else {
        top.CQ.WCM.on("sidekickready", function(sidekick) {


EDIT - Long Code Explanation

The above script is written to work in any component without issue, not only init.jsp



should execute our code after the DOM is ready. CQ.WCM.getTopWindow()

selects the topmost window. If our script is executed after the sidekick is ready, the event sidekickready

would have already fired and therefore our code may not be executed.

Hence, we first check if the sidekick is available with top.CQ.WCM.isSidekickReady()

, otherwise we attach a listener to the event sidekickready

so that we are notified when it is ready.

Hope it helps.



All Articles