SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working in SharePoint 2010 Designer to create a custom page layout. I've added a SharePointWebControls:ScriptLink control but am not sure what the path is to my jQuery library. It's uploaded to the root collection's Site Assets, in subfolders /js/jquery/jquery-1.6.2.min.js.

The absolute URL to it is http://vmdev195/SiteAssets/js/jquery/jquery-1.6.2.min.js. Is there a way to give a relative path to this file in the ScriptLink control? This way the page will work on different servers that have the same folder/file structure. Thanks

share|improve this question
up vote 3 down vote accepted

If you're working in SharePoint Designer, then you can use a plain old tag instead and reference the .js file anywhere you want:

<script language="javascript" type="text/javascript" src="/Scripts/jquery.SPServices-0.6.2.min.js"></script>

Any relative path will work, whether it's in _layouts, a Document Library, or an external CDN.

share|improve this answer
Thanks, Marc. That worked beautifully :) For some reason, I forgot that the client-side options are available in asp:Content areas. Plus, Designer allows you to pick the file and it'll generate the path automatically. Very nice. – Alex C Aug 4 '11 at 14:18
[update] caveat: For 2013 MDS enabled sites, script tags won't work, use RegisterSOD or ScriptLink. – Hugh Wood May 22 '14 at 16:13
They still work, don't they? I seem to remember using them just fine, but I could be mistaken. – Marc D Anderson May 22 '14 at 22:10

Have you tried this?

<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<!-- ... -->

<SharePoint:ScriptLink runat="server" Name="/SiteAssets/js/jquery/jquery-1.6.2.min.js" Localizable="false" />
share|improve this answer
Thanks, omlin. I've seen the SharePoint:ScriptLink tag but couldn't figure out what the difference is between that and the SharePointWebControls:ScriptLink tag. – Alex C Aug 4 '11 at 10:27
That doesn't work; it throws this error, even though the file is there: Cannot make a cache safe URL for "1033//siteassets/global/js/jquery/jquery-1.6.2.min.js", file not found. Please verify that the file exists under the layouts directory. What does work is this:…. Not the most convenient way to do it, but it works. – Alex C Aug 4 '11 at 10:50
Alex, I'm afraid you simply forget about Localizable="false" attribute.. That's why you're getting "1033" attached in front of the url. – Andrey Markeev Aug 5 '11 at 7:43
Thanks, omlin. Very helpful tip. – Alex C Aug 6 '11 at 5:37
For 2013 (v15) and current SharePoint Online (v16) you need to use a url token to get a site relative reference for the name property, like ~site/SiteAssets/js/jquery/jquery-1.11.1.min.js – John-M Nov 13 '14 at 18:00

Your Answer


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.