Friday, December 13, 2013

ExecuteOrDelayUntilScriptLoaded not executing

If at any point of time you are using ExecuteOrDelayUntilScriptLoaded in a page or specifically in a publishing page and finding it not working, there is a strong chance that you need to replace this function with other function called SP.SOD.executeFunc.

In SharePoint 2013, the correct way to execute function after script is loaded is to use SP.SOD class and not ExecuteOrDelayUntilScriptLoaded.

If its ExecuteOrDelayUntilScriptLoaded({functionname}, "sp.js");

then replace it with

SP.SOD.executeFunc('sp.js', 'SP.ClientContext', {functionname});

This will also come handy specially when a user who has read / view only access the site where sp.js refuses to load when ExecuteOrDelayUntilScriptLoaded is used.

No comments:

Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to