Try our conversational search powered by Generative AI!

Detect if preview mode


Is it possible to detect if the page is rendered in previewmode. It seems like the request is exactly the same as in edit mode?

Sep 27, 2013 14:05

For me, when I check 

bool inEditMode = PageEditing.PageIsInEditMode;

is false when in preview mode.

I set a class to my container div according to this info, so I can use it in js.
Also, I have active=true in the querystring, don't you?

See a screenshot:

Perhaps I misunderstood you?

Edited, Sep 27, 2013 15:23

Actually, I get 'true' from that parameter in preview-mode. Looking at your screenshot, my url doesn't change at all. What version of Episerver do you use?

Sep 27, 2013 15:52

Yes, the fact that a version could be different crossed my mind too, as I don't remembed having this extended preview before I did the upgrade. I have 7.0.586.16 (should be the latest version). How about you?

Sep 27, 2013 15:55

I'm using 7.0.586.1. But it seems like you have a UI-addon installed (can see the "SV" icon in yourscreenshot), I installed that addon in another project (7.0.586.8) but have the same issue in that project. I'll try to install the latest UI, maybe that will help

Regarding the querystring in your screeenshot, "viewsetting=active:///true" is only changed when clicking on the icon for "toggle view settings" (the icon that looks like an eye). The preview-button doesn't seem to change the url

Sep 30, 2013 15:43

It's the same when I click preview, the value inEditMode is false.

It might be the version, now I have also upgraded to the latest patch 4.

Sep 30, 2013 16:25

Upgrading to 7.0.586.24 fixed this issue. The preview works fine for me now

Sep 30, 2013 16:49
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.