Archive for June, 2013

SharePoint Waiting for SP.js to Load

We spent our day here at my FT job trying to figure this our out … me a senior level .NET developer and two senior level SharePoint masters.

First we had nice newly created web part, running a jQuery based carousel of pictures. ¬†Everything was working fine, until we launched it to our SharePoint 2013 publishing page. ¬†SP 2013 Team Pages worked just fine, SP 2010 worked just fine, and edit mode of the SP2013 publishing page worked just fine … but when we moved it to Checked In and Published, literally the web part just stopped.

Also 3 hours later we found what was happening:

We were running the command:

ExecuteOrDelayUntilScriptLoaded(function () { myFunc(); }, "sp.js");

We wanted to make sure that “sp.js” was loaded BEFORE calling our “myFunc” call … well on publishing pages in SP 2013 … they have changed the function for this to

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

Gosh … there is 3 hours lost on my day … jeepers; we made the switch and everything worked immediately

Advertisements

Leave a comment