0

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

2

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

  • 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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