JavaScript injection in SharePoint Online - Office 365 Developer Patterns and Practices

Download this episode

Download Video


Andrew Connell walks through the Office 365 Patterns & Practices Scenario injecting JavaScript into SharePoint Online pages. This code can be found on GitHub here



Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image

      Opening comments

    • User profile image

      This is just hilarious.... The amount of code AND showing how to do this in a provider hosted app :-)

      If the O365 service doesn't support adding a script tag to all pages without "bending over backwards" like this it is pretty sad.

    • User profile image

      It seems the code no longer exists under the filename listed.

    • User profile image

      I agree with Jonas, There is NO server side code allowed in Sharepoint Online (sharepoint hosted). Not helpful

    • User profile image

      Seems like source code has been moved to:

    • User profile image

      Guys, have anyone managed to run this example? I am getting Access Denied exception although the App has Full Control permissions on Web and Site levels.

    • User profile image
      Dr Doom

      "microsoft does not recommend creating custom master pages or customizing the default master page(...), the reason for this is that if the master page is customized a site collection will not get any fixes or new capabilities that are added to the platform by microsoft"

      are you kidding me? that is probably the main reason why people should create custom master pages. Whenever microsoft realeases "any fixes or new capabilities" they could end up ruining the functionality of my site, i'd rather have more control over when and what "new capabilities" are added.

    • User profile image
      Nitin Khubani

      Hi Guys,

      I have been following this tutorial and it has helped a lot! Great one!!!

      However facing issues with Mobile pages. So I have a JS which must run on all pages of SharePoint to have control of them. Now, I want it to be executed on mobile pages too but its not being injected to mobile pages because it seems they dont have master page.

      The URL format is like;


      Can anyone help me to get rid of this issue :(

    • User profile image

      I would like to see an official reference to where exactly Microsoft says creating a custom master page is not recommended.

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.