Hi I am creating some web parts in SharePoint 2010 non sandboxed solution. I want to include some JavaScript files and CSS on each page of my site. But I don't want to include my files on each web part or in master page as master page may be changed. Is there any way so that I could dynamically load js/css files which are relevant to a specific page only? Kindly suggest. Thanks
|
Give that you are not using a sandboxed solution, you can use a Delegate Control, specifically the AdditionalPageHeadDelegate:
Complete guide, and loose source of the above: http://blogs.msdn.com/b/kaevans/archive/2011/04/06/adding-jquery-to-every-page-in-sharepoint-with-delegate-controls.aspx Otherwise, look in the a CustomAction: http://weblogs.asp.net/jan/scriptsrc-referencing-javascript-files-with-sharepoint-2010-custom-actions |
|||||||||
|