Sometimes we simply want to know in JS if the user is on regular site view or experience editor view or any other view. In JS, we can do this by below lines of code - var isEditMode = function ( ) { return typeof Sitecore !== "undefined" && Sitecore && Sitecore.PageModes && Sitecore.PageModes.PageEditor; } var isPreviewMode = function ( ) { return typeof Sitecore !== "undefined" && !isEditMode() } var isNormalMode = function ( ) { return typeof Sitecore === "undefined" }
This blog is created to serve as a repository of quick tips for Sitecore developers. I have learnt a lot from the programming community and this is my attempt to give back to the community.