Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Is there any way to find out whether we have opened page in Touch UI or classic UI in javascript

Avatar

Level 2

Is there any way to find out whether we have opened this page in Touch UI or classic UI in javascript

like we have in classic UI to find out whether page is in edit mode or design mode.

CQ.WCM.editMode

Please suggest.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

I would recommend to you widget API method provided for these:

https://docs.adobe.com/docs/en/cq/5-6-1/widgets-api/index.html?class=CQ.WCM

getMode() - Returns either the current WCM mode: MODE_EDITMODE_PREVIEW and MODE_DESIGN, or MODE_TIMEWARP

Thanks

View solution in original post

3 Replies

Avatar

Level 9

Easiest way to find out a solution in javascript is through AEM page URL.

  1. If the URL contains ëditor.html" then it is TOUCH UI
  2. If the URL contains "cf#" then it is in classic view.

This could work for now However, if someone changes these URL's ( through config or adobe next release), this solution wont work.

---Jitendra

manank71376227 wrote...

Is there any way to find out whether we have opened this page in Touch UI or classic UI in javascript

like we have in classic UI to find out whether page is in edit mode or design mode.

CQ.WCM.editMode

Please suggest.

 

Avatar

Correct answer by
Level 10

Hi,

I would recommend to you widget API method provided for these:

https://docs.adobe.com/docs/en/cq/5-6-1/widgets-api/index.html?class=CQ.WCM

getMode() - Returns either the current WCM mode: MODE_EDITMODE_PREVIEW and MODE_DESIGN, or MODE_TIMEWARP

Thanks

Avatar

Level 9
Adding to what already said about using cq api,  just make sure cq widgets do not get loaded on publish instance. - Jitendra