I was looking at potential ways to include jQuery and Paul Grenier's Accordeon Quick launch (https://www.nothingbutsharepoint.com/sites/eusp/Pages/jquery-for-everyone-accordion-left-nav-with-cookies-speed-test.aspx) into a site master page and came across this blog post:

2 Answers
2

If you are going to be using jQuery on more than just a few pages this should be fine. Adding it to the individual pages would be a pain and difficult to maintain.

Also, I would still use this method even if you only need jQuery after the page has loaded. If you need it use it...

I also disagree with the exclude when you are "not even sure if the user will use your jQuery". If the functionality will help a significant number of users then keep it. If it's not helping anyone then it shouldn't be there.

Abe, I am the author of the above comment. My point is not to exclude jQuery, but to include it in a more efficient way. The post mentioned in the question just adds jQuery in the head section, and doesn't consider other practices like lazy loading.
–
ChristopheApr 22 '11 at 2:22

I see your point. Have you seen real world improvement from lazy loading? While it is more efficient, I have yet to see these types of performance tweaks generate any real improvement. It's entirely possible that this is due to the fact that I have not worked on any insanely high traffic web sites though...
–
Abe MiesslerApr 22 '11 at 2:45

An obvious example is SharePoint 2010 (ribbon, calendar). It's not just about high traffic, it's also about priorities when the browser renders the page content. Let me post a separate reply to show other options.
–
ChristopheApr 22 '11 at 2:59

As I am quoted in the question, and also to follow up on Abe's reply: there are several other ways to include jQuery and JavaScript in a Master Page.

The post in the original question shows an old school method, which is to add a script tag to the head section of the page. The author doesn't explain why he thinks it is the best way, and I simply believe that he is wrong.

Some script tags could for example be added at the bottom of the body section. This would be an option if the plugin only needs to be activated after the page has loaded.

I did some research, and here are other approaches I found (some might not apply to MOSS):

Hey Christophe! I don't know about being a master designer, but we use jQuery quite heavily and we use the delegate controls option adding it to the additional page head delegate control at the Farm level. It works for us and we do not see a performance hit as of yet.
–
spevilgeniusApr 22 '11 at 7:22