0

I am adding jQuery to sharepoint like this:

<SharePoint:ScriptLink ID="ScriptLink6" language="javascript" name="~sitecollection/Style Library/jquery.min.js" runat="server" OnDemand="False" LoadAfterUI="True" />

This is added to mysite15.master and oslo.master

The problem is that if i go to followed documents or my documents, which is under http://mydomian/personal/myusername/.. ..SharePoint looks for jQuery at http://mydomian/personal/myusername/Style Library/jquery.min.js It is not practical for me to add jquery to every single user's personal site.

Is there any way to make SharePoint look for jQuery at my root site collection?

2 Answers 2

1

There is no "root" site collection in SharePoint, just a site collection at the main domain address. It's not any more important or noteworthy than any other site collection.

Either load it from an absolute url at that site, store it on the hive or load it from a third party CDN (https://developers.google.com/speed/libraries/devguide#jquery)

2
  • how do I correctly link to jQuery with the absolute URL? If i do like this: <SharePoint:ScriptLink ID="ScriptLink6" language="javascript"name="http://mydomian/Style%20Library/jquery.min.js" runat="server" OnDemand="False" LoadAfterUI="True" /> ..The site won't load
    – Koiski
    Jul 21, 2014 at 15:14
  • If you don't care about load order, use <script type='text/javascript' src="mydomian/Style%20Library/jquery.min.js"></script>
    – Aboba
    Jul 21, 2014 at 15:52
1

You should be able to change the reference URL to something more specific, like the full URL of the site collection, or your CDN, like name="https://mydomain/sites/here/jquery.js"

1
  • how do I correctly link to jQuery with the absolute URL? If i do like this:<SharePoint:ScriptLink ID="ScriptLink6" language="javascript"name="http://mydomian/Style%20Library/jquery.min.js" runat="server" OnDemand="False" LoadAfterUI="True" /> ..The site won't load
    – Koiski
    Jul 21, 2014 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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