0

Working on getting javascript files deployed with our solution.

Added a module for the scripts with jquery-1.7.1.min.js added to it for example. Elements.xml is:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="Scripts" Url="JqueryFiles1">
    <File Path="Scripts\jquery-1.7.1.min.js" Url="jquery-1.7.1.min.js" />
</Module>
</Elements>

It successfully deploys the javascript file to the document library "JqueryFiles" perfectly file (I can even download them from the library and verify they have content).

Problem is when I load them in the masterpage, the scipt files come up blank (file exists but is empty) when I check them.

Tried loading using a standard script tag, SharePoint:ScriptLink and CustomAction in the solution, same thing everytime.

<SharePoint:ScriptLink runat="server" Defer="false" Name="~sitecollection/JqueryFiles/jquery-1.7.1.min.js" />
<script src="../../JqueryFiles/jquery-1.7.1.min.js" type="text/javascript"></script>

Any thoughts?

2
  • Can you clarify what you mean by "the script files come up blank" what do you mean? I'm confused since you say you can download them and verify there's content.
    – Robbert
    Commented Jul 2, 2013 at 1:12
  • I can navigate to All Site Content, see the javascript file in the document library and download a copy to verify it has content in the file, but when inspect the file with browser developer tools, it is literally blank (no code, just an empty file). So the file gets uploaded to the sharepoint site properly, but when the masterpage tries to load it something isn't working right. Commented Jul 2, 2013 at 13:07

1 Answer 1

1

It looks as though you deploy to Url="JqueryFiles1". Remove the 1 and it should be ok.

1
  • Very close! Although the document library was called JqueryFiles, its internal name was JqueryFiles1, so the 1 was needed to even deploy. I needed to in fact add the 1 to the script links. I feel like such a noob for missing that because I thought I'd get a resource not found error when inspecting in browser, not a blank file. Commented Jul 2, 2013 at 13:18

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.