0

I've created a new ASPX page in the root of an O365 site collection (not in Site Pages or Pages, just in the very root folder via the All Files view in SharePoint Designer), and struggling to work out how to include the required SP.JS libraries that get loaded as standard in a Web Part Page.

I've tried a few different things, including the suggested <Sharepoint:ScriptLink> tags I've seen mentioned elsewhere; also tried a direct <script> tag to the literal file locations inside the /_layouts folder.

Neither seems to work and I'm using a verbatim copy of some JS that works fine on a web part page.

Any ideas? This seems to be one of those questions there are a ton of answers to but none seem to work for me.

  • have you tried with Page.RegisterStartupScript Method and ClientScriptManager.RegisterStartupScript Method?? – DvG Jul 20 '17 at 9:56
  • No, how do I use those? Not familiar with that code. – Thomas Gass Jul 20 '17 at 9:57
  • pls check this example: msdn.microsoft.com/en-us/library/z9h4dk8y(v=vs.110).aspx – DvG Jul 20 '17 at 10:19
  • I'm not really following how that is relevant; the code example is missing any sort of reference to SP.JS. Am I missing something? – Thomas Gass Jul 20 '17 at 10:21
  • This is a poor practice. Working against the platform like this is going to cause all sorts of problems in the long run. You're better off using the structure SharePoint gives you (SitePages, etc) and building your solutions atop the platform, rather than sidestepping it. – Derek Gusoff Jul 20 '17 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.