Skip to main content
prabodh
Level 2
Mar 31, 2016 12:40 PM UTC
Solved

AEM 6.1 Preview mode

Hi All,

Preview mode doesn't function properly on clicking the preview option, but working fine if we refresh the page. Could anyone help me to resolve this issue ? Is it a known bug ?

Thanks in advance!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
kautuk_sahni
kautuk_sahniAccepted solution
Level 9
Apr 1, 2016 4:27 AM UTC

Hi

Please have a look at this article, this seems like your problem too.

Link:- http://blogs.adobe.com/dmcmahon/2012/03/12/cq5-preview-mode-in-sidekick-does-not-refresh-automatically/

//preview mode in sidekick does not refresh automatically

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.

Workaround :- https://helpx.adobe.com/experience-manager/kb/LinkToPreviewMode.html

 

Please check the browser console errors and error.log to better debug this problem.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni

7 replies

edubey
Level 10
Mar 31, 2016 5:21 PM UTC

Have you changed anything in init.jsp file?

Which AEM version you are using?

Translate
Lokesh_Shivalingaiah
Level 10
Mar 31, 2016 8:41 PM UTC

see if there is any JS error when you change to preview mode

Translate
kautuk_sahni
kautuk_sahniAccepted solution
Level 9
Apr 1, 2016 4:27 AM UTC

Hi

Please have a look at this article, this seems like your problem too.

Link:- http://blogs.adobe.com/dmcmahon/2012/03/12/cq5-preview-mode-in-sidekick-does-not-refresh-automatically/

//preview mode in sidekick does not refresh automatically

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.

Workaround :- https://helpx.adobe.com/experience-manager/kb/LinkToPreviewMode.html

 

Please check the browser console errors and error.log to better debug this problem.

Thanks and Regards

Kautuk Sahni

Translate
Kautuk Sahni
prabodh
prabodhAuthor
Level 2
Apr 5, 2016 1:40 PM UTC

Hi Kautuk,

I have tried adding previewReload:"true", but didn't work, the sidekick disappeared post adding it. Also, couldn't find any js errors on the browser console. Please let me know if there is any other way.

Regards,

Prabodh

Translate
prabodh
prabodhAuthor
Level 2
Apr 5, 2016 1:42 PM UTC

No, I haven't changed anything in init.jsp. Using AEM 6.1.

Translate
edubey
Level 10
Apr 5, 2016 1:45 PM UTC

Are you seeing this with all projects?

Can you share init.jsp u are using?

Translate
prabodh
prabodhAuthor
Level 2
Apr 5, 2016 2:12 PM UTC

We have only one project, but also seeing the same behavior in Geometrix project.

init.jsp:

<%@page session="false"%><%--
  Copyright 1997-2010 Day Management AG
  Barfuesserplatz 6, 4001 Basel, Switzerland
  All Rights Reserved.

  This software is the confidential and proprietary information of
  Day Management AG, ("Confidential Information"). You shall not
  disclose such Confidential Information and shall use it only in
  accordance with the terms of the license agreement you entered into
  with Day.

  ==============================================================================

  Default init script.

  Draws the WCM initialization code. This is usually called by the head.jsp
  of the page. If the WCM is disabled, no output is written.

  ==============================================================================

--%><%@include file="/libs/foundation/global.jsp" %><%
%><%@page import="com.day.cq.wcm.api.AuthoringUIMode,
                  com.day.cq.wcm.api.WCMMode" %><%
%><%

    if (WCMMode.fromRequest(request) != WCMMode.DISABLED) {
        String dlgPath = null;
        if (editContext != null && editContext.getComponent() != null) {
            dlgPath = editContext.getComponent().getDialogPath();
        }
        AuthoringUIMode authoringUIMode = AuthoringUIMode.fromRequest(slingRequest);
        if (authoringUIMode != null && authoringUIMode != AuthoringUIMode.CLASSIC) {
            %><cq:includeClientLib categories="cq.authoring.page" /><%
        } else {
            %><cq:includeClientLib categories="cq.wcm.edit" />
            <script type="text/javascript">
                (function() {

                    var cfg = <%
                            try {
                                sling.getService(com.day.cq.wcm.undo.UndoConfigService.class)
                                        .writeClientConfig(out);
                            } catch (Exception e) {
                                // ignore
                            }
                        %>;
                    <%-- explicitly set page path, as under some circumstances, CQ.WCM.getPagePath() --%>
                    <%-- may yield unwanted results at this point                                    --%>
                    cfg.pagePath = "<%= xssAPI.encodeForJSString(currentPage.getPath()) %>";

                    if (CQClientLibraryManager.channelCB() != "touch") {
                        var isEditMode = <%= WCMMode.fromRequest(request) == WCMMode.EDIT ? "true" : "false" %>;
                        if (!isEditMode) {
                            cfg.enabled = false;
                        }
                        CQ.undo.UndoManager.initialize(cfg);
                        CQ.Ext.onReady(function() {
                            CQ.undo.UndoManager.detectCachedPage(<%= System.currentTimeMillis() %>);
                        });
                    }
                })();

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

                });
            </script>
            <%
        }
    }
%>

Translate