SharePoint 2013: ExecuteOrDelayUntilScriptLoaded not executing after page publish

23. March 2013 04:29 by Mahmoud Farhat in SharePoint 2013  //  Tags:   //   Comments (0)

In SharePoint Client Object Model and after migration from SharePoint 2010 to SharePoint 2013 your Client Object Model code is running well when the page is Unpublished but once you Published it your Client Object Model Code is not working, don't worry this is not a bug but Microsoft did some changes in the "ExecuteOrDelayUntilScriptLoaded" method in SharePoint 2013 and renamed it to be "executeFunc"

Example:

SharePoint 2013 Code:

SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady);

function sharePointReady() {
   alert("Ready");
}

SharePoint 2010 Code:

ExecuteOrDelayUntilScriptLoaded(sharePointReady, "sp.js");

function sharePointReady() {
   alert("Ready");
}

 

References:

http://msdn.microsoft.com/en-us/library/jj245759.aspx