How to inject Jquery Code in SharePoint to be executed on every Page of a sharepoint site without modifying the master page?


  • Hi

    What I should do to inject Jquery Code into SharePoint that will be executed on every Page of a SharePoint site without editing the masterpage.

    Is there a specific way to use Jquery to avoid any conflict with the existing javascript code in  SharePoint?





    • Edited by Kabylie Saturday, November 11, 2017 1:08 AM
    Saturday, November 11, 2017 12:46 AM


All replies

  • Hi,

    You can use Delegate Controls to add jQuery to each page of SharePoint without modifying it.There are multiple Delegate Controls available OOB in SharePoint Master page like the one below. You can over ride them using a webpart to inject jQuery into master page without modifying it. 

    <SharePoint:DelegateControl runat="server" 

    Delegate controls are particularly useful in SharePoint when you want to add functionality to all pages within your site without changing the master page. For example, if you want to add an external JavaScript library (such as JQuery) to every page, you can do this easily by registering a delegate control. An example of this approach can be seen here

    You can also refer these examples :

    Example 1

    Example 2



    Please Up Vote and Mark this as Answer if it helps.

    Saturday, November 11, 2017 6:07 AM
  • Hi Akli,

    We can inject JavaScript to any Site or Site Collection via a User Custom Action's ScriptLink property.

    The following articles for your reference:

    The easiest way to add Script and Brand your SharePoint and SharePoint Online


    Best Regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Monday, November 13, 2017 7:22 AM