When I try to load a remote file through ScriptLink it doesn't work.

<!--SPM:<SharePoint:ScriptLink ID="ScriptReg2" language="javascript" name="https://somesite.blob.core.windows.net/scripts/my-script.js" Defer="false" runat="server" Localizable="false"/>-->

The ScriptLink always look in /_LAYOUTS/1033 for the scripts to load. I doubt you can load remote js files with it.

Note: _LAYOUTS/1033 would be true when the SharePoint language is set to English. For multilingual site we can use Localizable property of ScriptLink, where you can set it true or false. I believe that false looks for the scripts in the /_layouts folder and true would look at the localization folder

You can choose the traditional <script> block to load remote files.

Check out When to use scriptlink, scriptblock and script and ScriptLink vs Script tag, what’s the difference?

|improve this answer|||||

No, it Looks only relative to the "_layouts"-Path

|improve this answer|||||
  • @ leopold - please argument your answer or it will risk being deleted. – Marius Constantinescu - MVP Sep 9 '15 at 7:33
  • Looks perfectly valid answer to me. ScriptLink is only scoped to local _layouts path, it cannot be used for external sources. – Jussi Palo Sep 9 '15 at 8:00
  • @C.Marius. There is no Argumentation, it does what it does. The only Argumentation because of lacking documentation is looking at the generated html-tags or decompiling the class where you can find that the Output is built using "SPHttpUtility.UrlPathEncode(SPUtility.MakeBrowserCacheSafeLayoutsUrl(str1, localizable), true)" where str1 is the path string given to the control. But the short answer is still: No, it doesn´t because it Looks only for files in layouts. (where the later one is the Argumentation) – Leopold Lerch Sep 9 '15 at 9:14
  • 1
    That is exactly what i mean - not arguing on your answer, but on the lack of details on your answer. Please update with your comments, it should be sufficient. – Marius Constantinescu - MVP Sep 10 '15 at 7:55

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.