Is it documented somewhere for what permissions a user needs to have for sp.js to load? If so, is there a difference for it loading in a certain location (Site Pages, Pages, etc.)?


We have item style that opens a URL in a dialog using SP.UI.ModalDialog. Two site collection admins are able to click and open the dialog. Test user with read access to site wasn't able to load and was receiving object undefined error. Moved test user to edit permissions and was able to open the dialog.

  • 1
    Not aware of any such limitation documented or elsewhere. It would not be loded in some cases. Try explicitly calling sp.js using SP.SOD.executeFunc like in Vadim's answer here sharepoint.stackexchange.com/a/101857/13799
    – Akhoy
    Oct 12, 2015 at 15:43
  • Yeah I've come across quite a few places where it doesn't get loaded and need to use SOD. With this question I'm not so much worried with how to get this scenario to work, just looking to see if anyone has any knowledge on when/why this happens to load/not load. In this case it seems to be permissions, but is that always the case? If yes, what permissions where? If anyone has any info on questions like that.
    – Jordan
    Oct 12, 2015 at 15:51
  • You'd have to dig through a lot to find this. To avoid such scenarios, recommended approach is to load it in the master page like this : blog.qumsieh.ca/2013/10/30/…. Having said that, I would like to see some answers on this as well.
    – Akhoy
    Oct 12, 2015 at 16:13

2 Answers 2


Following the comment from Akhoy, the solution that worked for me was to modify the masterpage header to explicitly load the sp.js library, using this piece of code:

<SharePoint:ScriptLink ID="ScriptLink21" Name="sp.js" runat="server" OnDemand="false" LoadAfterUI="true" Localizable="false" />

Just put it inside the header section.


Just make sure that the logged user has access to view the master page. In some sites, the users can access the subsite but cannot see the site collection where the master page is located.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.