Question

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

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top