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 the following code, but I am very sure it will only work in the homepage of our website, and not when having the following scenario


<SharePoint:ScriptLink language="javascript" name="/js/SP.Ribbon.js" LoadAfterUI="true" OnDemand="false" runat="server" Localizable="false"/>

  ExecuteOrDelayUntilScriptLoaded(initCOBRibbon, '/js/SP.Ribbon.js');

Is there anyspecific way to put in the name attribut that it should be the layouts in the root?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

ScriptLink is automatically linked to layouts folder in the hive (14-folder). So the name="/xxx/js/SP.Ribbon.js" goes to /web1/web2/_layouts/xxx/js/SP.Ribbon.js which is actually the same file as if it would be <root>/_layouts/xxx/js/SP.Ribbon.js

share|improve this answer
the last line in my example, Do I need to put the same path, or just the name of the file? –  Esteban V Mar 5 '12 at 13:41
the name refers to the file path seen from 14\Layouts. So if your file is in 14\Layouts\my-awesome.js, the name is "my-awesome.js" If your script is inside a subfolder(s), add them into name with slash (not backslash): 14\Layouts\xxx\js\SP.Ribbon.js -> name="xxx/js/SP.Ribbon.js" –  Anatoly Mironov Mar 5 '12 at 13:44

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.