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 1520 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 51 posts 180 karma points
    Mar 04, 2022 @ 05:17
    Nick Hoang
    0

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

Please Sign in or register to post replies

Write your reply to:

Draft