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"
}
Comments
Post a Comment