CHunky Universe of Vigourous Astonishing SHarepoint :)

Really good examples how to detect a sharepoint page in edit mode.

function isEditMode() {
    var publishingEdit = window.g_disableCheckoutInEditMode,
        form = document.forms[MSOWebPartPageFormName],
        input = form.MSOLayout_InDesignMode || form._wikiPageMode;
    return !!(publishingEdit || (input && input.value));

I published this even as an answer on sharepoint SE.

.Net Goodies

In this post I am going to explain different ways to detect SharePoint page mode through client side scripts

If the page is publishing then we can query following  JavaScript variable to find the Page status

if(g_disableCheckoutInEditMode == true) {
   alert('Page is in edit mode');
else {
   alert('Page is in display mode');

Another options for publishing page

//Add following in master page

<script type="text/javascript">
    var IsEditMode = false;

<PublishingWebControls:EditModePanel runat="server" id="EditModePanelToFindEditMode">
     <script type="text/javascript">
        IsEditMode = true;

//Now through script you can use the variable IsEditMode

We can also query the PageState object which has property ViewModeIsEdit. The problem with this is because the object gets initialized only after loading sp.ribbon.js.

Another option

var IsEditMode = 
if (IsEditMode == "1") { // page is in edit mode } 
else { // page is in browse mode }

For WIKI pages


View original post 27 more words

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Daniel Chronlund Cloud Tech Blog

News, tips and thoughts for Microsoft cloud fans

Вула Чăвашла

VulaCV - Чăвашла вулаттаракан сайт

Discovering SharePoint

And going crazy doing it

Bram de Jager - Architect, Speaker, Author

Microsoft 365, SharePoint and Azure

SharePoint Dragons

Nikander & Margriet on SharePoint

Mai Omar Desouki

PFE @ Microsoft

Cameron Dwyer

Office 365, SharePoint, Azure, OnePlace Solutions & Life's Other Little Wonders


Me and My doings!

Share SharePoint Points !

By Mohit Vashishtha

Jimmy Janlén "Den Scrummande Konsulten"

Erfarenheter, synpunkter och raljerande om Scrum från Jimmy Janlén

Aryan Nava

DevOps, Cloud and Blockchain Consultant


SharePoint for everyone


Ryan Dennis is a SharePoint Solution Architect with a passion for SharePoint and PowerShell

SharePoint 2020

The Vision for a Future of Clarity

Aharoni in Unicode

Treacle tarts for great justice

... And All That JS

JavaScript, Web Apps and SharePoint


Mostly what I know and share about...

%d bloggers like this: