SharePoint Checking for Design Mode

Here is a snippet of code to help with checking for design mode in SharePoint if ever I need it in the future.

var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;

It’s particularly important to do this check if you’re modifying the DOM with JavaScript in a content editor as the content editor web part will save that injected HTML leading to doubling up on rendered HTML.

Uncategorized

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s