What is meaning of OnDemand scripts and what is not-on-demand scripts?
In SharePoint 2013, when do we use SP.SOD.executeFunc and when to use ExecuteOrDelayUntilScriptLoaded ?
What is best practice?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
On Demand scripts are the one which we load only when we need it in a page. We put a reference to it but it won't load until we call for it instead of the usual one which gets loaded every time the page loads. A very good blog on this could be found here
ExcuteOrDelayUntilScriptLoaded does not trigger loading an on demand script (SOD)! It schedules an asynchronous callback function which will be called when the script has signaled finished loading.
SP.SOD.executeFunc is used to load on demand scripts (ScriptLink.OnDemand=true). From the link I mentioned above
Best practice is to use On demand scripts as and when possible as it reduces page load time considerably.