Skip to content

Instantly share code, notes, and snippets.

@hammadbinarif
Last active May 23, 2017 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hammadbinarif/d1bbeb34b6eab12f7eb5cbfff172b870 to your computer and use it in GitHub Desktop.
Save hammadbinarif/d1bbeb34b6eab12f7eb5cbfff172b870 to your computer and use it in GitHub Desktop.
_spBodyOnLoadFunctionNames.push("myScriptStartup");
function myScriptStartup () {
var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;
if (inDesignMode == "1") {
// page is in edit mode
// Do things differently here
console.log('Page is in edit mode. so we will not execute the custom script');
}
else {
// regular script execution goes here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment