How to Fix Issues with SharePoint’s Script on Demand (SOD) System

FiveP News

How to Fix Issues with SharePoint’s Script on Demand (SOD) System

Kieran Cumming March 6, 2017
How to Fix Issues with SharePoint’s Script on Demand (SOD) System

I recently encountered issues with SharePoint’s script on demand (SOD) system (learn more here http://www.migee.com/2015/09/24/understanding-sharepoint-and-script-on-demand-sod/) that caused me to scratch my head. For this project, we have several custom JavaScript components being loaded on the page, all being initialised using SOD.

Issues with SharePoint's Script

Some of these components are embedded in the master page, and some as web parts in the page. I found however that in IE11, if the script had already been loaded, executeFunc would only fire once, leaving most of my components broken.

Eg:

I could resolve this by changing the SP.SOD.executeFunc call to SP.SOD.loadMultiple:

I haven’t done any performance profiling to test if there’s any difference between the two, however if there is any difference then I certainly don’t notice it.

After making the change, my scripts are now working in all browsers!

If you are still experiencing this issue, please don’t hesitate to reach out. Enter your message here https://fivep.com.au/contact-fivep/.

Thanks.

K.

Enjoyed this article? Stay up to date with our latest news...