Adding JavaScript and stylesheets with an AdditionalPageHead delegate control

The AdditionalPageHead control is one of the most commonly used delegate controls by developers to add custom code to the page. Controls registered to the AdditionalPageHead control are added to the <head> element of each page and multiple controls may be added, unlike most other delegate controls that only allow one user control.

In this recipe, we will create an ASCX user control that will add references to a custom stylesheet and custom JavaScript. We will then register the control to be added to the AdditionalPageHead delegate control. Using an AdditionalPageHead delegate control allows us to add our custom stylesheet and custom JavaScript to every SharePoint page, ...

Get SharePoint 2013 WCM Advanced Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.