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

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

Please Sign in or register to post replies

Write your reply to:

Draft