4

I am getting a white page after adding jquery to my master page:

<!--MS:<SharePoint:ScriptLink language="javascript" name="/_catalogs/masterpage/mymp/js/jquery-1.11.0.min.js" ID="jquery" Localizable="False" LoadAfterUI="True"  OnDemand="true" runat="server" >-->
<!--ME:</SharePoint:ScriptLink>-->

What could be wrong?

The rendered page returns this:

<html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"><meta name="Robots" content="NOINDEX " /></head><body></body>
                <script type="text/javascript">
                 var gearPage = document.getElementById('GearPage');
                 if(null != gearPage)
                 {
                     gearPage.parentNode.removeChild(gearPage);
                     document.title = "Errore";
                 }
                 </script>
                 </html>
Gyonder
  • 1,183
  • 3
  • 28
  • 49

3 Answers3

2

You are probably getting this error because SharePoint does not find the file!

Double check the path to the jQuery.js file and that the file is published. Or, use a normal <script> tag to get around the problem with the whole page blowing up when the file is not found.

Robert Lindgren
  • 24,520
  • 12
  • 53
  • 79
1

Scriptlink works as well, just remove OnDemand="true" which requires calls to SP.SOD.execute or SP.SOD.executeFunc methods for any JS script referenced to execute.

Detailed explanation has been posted here before: jQuery not being loaded from master page

The above works provided if your jquery reference path is correct!

Ransher Singh
  • 2,456
  • 1
  • 17
  • 25
0

My two cents on this subject...

I got the same issue when referencing a JS file in _catalogs folder with ScriptLink. I traced it to the starting '~' key.

In my case this worked (notice the ~sitecollection/ part):

name="~sitecollection/_catalogs/masterpage/mymp/js/jquery-1.11.0.min.js"
Slaven Semper
  • 1,953
  • 1
  • 14
  • 35