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>
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.

3
  • I've used the normal tag script.thnaks
    – Gyonder
    Feb 3 '14 at 10:45
  • excuse me but can anyone elaborate on the comment 'use a normal <script> tag'? I have the same problem but unfortunately I don't get the answer... tnx!
    – Verthosa
    Feb 5 '15 at 15:23
  • I used this:<script language="javascript" src="/Style Library/scripts/jquery-1.10.1.min.js"></script>
    – Gyonder
    Feb 5 '15 at 15:41
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!

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"

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.