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 394 posts 1477 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 69 posts 305 karma points
    Dec 23, 2019 @ 11:58
    Casper
    1

    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 69 posts 305 karma points
    Dec 23, 2019 @ 12:02
    Casper
    1

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

  • 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