Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy jQuery using a SharePoint Feature or physical files?

We are about to undertake a rather large customization of SharePoint and I wanted to get some feedback prior to jumping in with both feet. One of the issues we are kicking the tires on is do we deploy the jQuery javascript library to the 12 hive directly (making it available in _layouts for each site etc.) or do we wrap it up in a feature and activate that feature for each site? I have also seen two projects on CodePlex that wrap it up in features and that could be a third option I guess.

Thoughts?

like image 317
Goyuix Avatar asked Jan 28 '09 16:01

Goyuix


2 Answers

options and commentary on www.sharepointblogs.com

follow the link above or google it.

Summary is that modifying the 12 hive directly is easy but unsupported (i.e. Microsoft reserves the right to destroy your environment at will)

recommended option on above link is:

Use the AdditionalPageHead Delegate Control (my favorite!)

By providing the contents for the AdditionalPageHead Delegate Control that is used by all the out-of-the-box master pages, you can make sure the the jQuery library is loaded by all the SharePoint pages. The AdditionalPageHead Delegate Control allows multiple controls to provide contents, so it’s a great extensibility scenario. To accomplish this you need to build a web user control (ASCX file), that contains the script tag to load the jQuery library:

<%@ Control Language="VB" ClassName="jQueryControl" %>
like image 58
Ric Tokyo Avatar answered Oct 14 '22 08:10

Ric Tokyo


You could also use the Google AJAX Libraries API. By adding some script to your SharePoint master page (for example), any version of jQuery you prefer can be downloaded from Google without any need to deploy the .js file.

There are also numerous potential speed improvements:

  • Google's jQuery .js file may already be cached in the users browser (thanks to other sites using this facility)
  • browsers usually only allow a certain number of connections to the same server, so this allows another connection to open in parallel
  • the file is downloaded from the users nearest geographical location (I think)

This is an increasingly popular solution that I've heard nothing but good things about. Check it out at: http://code.google.com/apis/ajaxlibs/.

like image 42
Alex Angas Avatar answered Oct 14 '22 10:10

Alex Angas