Book Image

SharePoint 2013 WCM Advanced Cookbook

By : JOHN CHAPMAN
Book Image

SharePoint 2013 WCM Advanced Cookbook

By: JOHN CHAPMAN

Overview of this book

Table of Contents (19 chapters)
SharePoint 2013 WCM Advanced Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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, regardless of which master page is being used. This is particularly useful when a custom master page is not required and when managing the master pages for sites on a large scale becomes impractical.

Getting ready

We should have already created...