Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a question regarding the additional page head delegate control. Basically this delegate controls helps to register some scripts in my case.

But i have 2 different additional page head delegate controls for special reason, now in both of this delegates I want to register a JQuery script.

So for example if one feature is activated JQuery will be registered, if another feature is activated the JQuery will be registered again, but now, when both feature activated i want to have same effect. So in case when 2 features activated will there be 2 JQuery scripts registrations or only one? And how do i best do it, so that it always is one script that is registered.

Thanks in advance

PS: both delegates will contain other custom scripts registrations

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Try using ScriptLink

<sharepoint:scriptlink defer="false " id="SPScriptLink " localizable="false " name="jquery-x.x.x.js " runat="server"></sharepoint:scriptlink> 

or

<SharePoint:Scriptlink runat="server" Name="~sitecollection/Style Library/[YOUR SITE]/js/jquery.js" Language="javascript" />

The ScriptLink control ensures that the script is loaded only once and will also ensure that other dependencies have been loaded first

share|improve this answer
    
So basically if i have 2 JQueries registered from additional page head, only 1 script will be regsitered on the page yes? –  Shkipper Nov 13 '13 at 8:52
    
Yes thats right –  Remko Nov 13 '13 at 8:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.