CQ5: preview mode in sidekick does not refresh automatically


If you are using the sidekick to switch between edit, design and preview modes, you may notice that the pages refreshes automatically when switching to edit and design mode, but not when switching to preview mode.

This can cause problems if you are using the WCMMode methods and properties in your application to display a different page view depending on the current mode (i.e. using conditional logic based on WCMMode.DESIGN, WCMMode.EDIT and WCMMode.PREVIEW).  If the page does not refresh when switching to preview mode, then it will display the same objects and state as it did in edit mode.


The solution is simply to force a page refresh automatically when switching to preview mode.

  1. Open /libs/wcm/core/components/init/init.jsp
  2. Add the previewReload property as follows and save the changes:
    CQ.WCM.launchSidekick("<%= currentPage.getPath() %>", {
        propsDialog: "<%= dlgPath == null ? "" : dlgPath %>",
        locked: <%= currentPage.isLocked() %>,
        previewReload: "true"
  3. Now CQ is setup to refresh automatically when switching to preview mode.

reference: (32750)

VN:F [1.9.22_1171]
Was this helpful? Please rate the content.
Rating: 7.9/10 (18 votes cast)
CQ5: preview mode in sidekick does not refresh automatically, 7.9 out of 10 based on 18 ratings

6 Responses to CQ5: preview mode in sidekick does not refresh automatically

  1. kris says:

    Hi there,

    I have overlayed the init.jsp followed your direction. And put the new init.jsp in /apps/wcm/core/components/init/init.jsp. When I tested it using the geometrixx site. It still loading the init.jsp in libs folder. Any ideas? Many thanks.

    • dmcmahon says:

      Hi Kris,

      Normally you only need to to refresh the page, or clear the browser cache to use the updated init.jsp. If this is not working you could try a different browser just for testing, and/or restart the CQ server.

      best regards,

  2. sam says:

    I completed the instructions as listed above, and it looks like I’ve set everything up correctly, but its not pulling my overlaid component. I’ve cleared cache and restarted the server, but still no change. Any ideas what may be going wrong? I’m using CQ 5.5.


    • dmcmahon says:

      You could try it on a fresh CQ 5.5 instance to rule out problems with any changes you may have made in your existing instance. If the problem is still occurring, you should open a new ticket in daycare for detailed investigation.

  3. Henry says:

    The same here: overlaying the init.jsp in cq5.5 won’t work.
    Maybe because /libs/wcm/core/components/init is actually not a component (no sling:resourceType here, only simple nt:folder).

    Anyway, when I do change the original init.jsp under /libs (not recommendet though) the reload of the page on pressing the preview button works. But there’s another bug:
    Switching back to edit-Mode leaves the sidekick collapsed. Another click is needed to expand it!

  4. Henry says:

    the reason for not being able to overload the init-Component is the way it is included:

    /libs/foundation/components/page/head.jsp Line 38: