Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul de Quant 403 posts 1521 karma points
    Dec 23, 2019 @ 11:53
    Paul de Quant
    0

    How to check for Preview Mode in Umbraco 8

    Hello,

    Hoping this is a straight forward question, but can anyone tell me what the code is to check if a page is in preview mode. I know what it was in Umbraco 7, but doesn't seem to work in 8.

    Thanks

  • Casper 70 posts 308 karma points
    Dec 23, 2019 @ 11:58
    Casper
    2

    One thing you will find when in preview mode is a cookie named UMB_PREVIEW with the value preview. When that guy exist, you are in preview mode.

  • Casper 70 posts 308 karma points
    Dec 23, 2019 @ 12:02
    Casper
    1

    The UmbracoContext also hold a flag telling you if it is preview mode: UmbracoContext.InPreviewMode

  • Nick Hoang 52 posts 182 karma points c-trib
    Mar 04, 2022 @ 05:17
    Nick Hoang
    0

    This works with Umbraco 7, doesn't work with Umbraco 8+

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies