コミュニティアチーブメントバーを展開する。

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

この会話は、活動がないためロックされています。新しい投稿を作成してください。

解決済み

AEM 6.1 Preview mode

Avatar

Level 2

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!

1 受け入れられたソリューション

Avatar

正解者
Administrator

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-automatical...

//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 返信

Avatar

Level 10

Have you changed anything in init.jsp file?

Which AEM version you are using?

Avatar

Level 10

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

Avatar

正解者
Administrator

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-automatical...

//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

Avatar

Level 2

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

Avatar

Level 2

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

Avatar

Level 10

Are you seeing this with all projects?

Can you share init.jsp u are using?

Avatar

Level 2

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>
            <%
        }
    }
%>