Is there a way to check that you are in Experience Manager from the model/entity in DXA? We want to print out placeholder values if they are not populated from component values only when in XPM mode.

We want to be able to set placeholder values for empty fields when our Editors are in XPM mode. But these placeholders may not appear when they are seeing them outside of XPM mode.



As a Clarification:

XPM Mode = When the editor is able to edit the page using Experience manager. It does not equal being on an environment that is capable of Experience manager.

1 Answer 1


Depends on what you call "XPM Mode". You can use Localization.isStaging() to test whether the environment is XPM-enabled. But that doesn't distinguish between the user request the Page in XPM or not.

  • "XPM Mode" is when the editor is using experience manager to edit content. So Staging is not XPM Mode. Dec 16, 2016 at 7:32
  • In that case the DXA Framework can't help you. I'm not sure if there is a way to distinguish viewing and editing of an XPM-enabled Page. You could check for presence of the preview-session-token cookie, but I don't think that is included for all XPM requests. Dec 16, 2016 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.