locked
Getting Unwanted JQuery Reference in Html for Some Pages Only RRS feed

  • Question

  • User1889380885 posted

    Hi 

    I'm getting the following reference <script src="../Scripts/jquery-1.8.2.js" type="text/javascript"></script> in my html output (as per View source) for some pages only. I'm not actually using this version of JQuery so I'm not sure why its appearing. 

    Other pages have the same Master Page but are not getting this reference. I've searched my whole site for any reference to 1.8.2 but nothing comes up.

    Does anybody know what I should check  ?

    Best

    Tuesday, October 8, 2013 9:06 AM

Answers

  • User1889380885 posted

    This was caused by a dll which was loading an older version of jQuery.

    I solved this by putting the following in global.asax which makes sure all jquery references are pointing to the same place:

    // Override JuiceUI mappings of JQuery
    ScriptResourceDefinition myScriptResDef = new ScriptResourceDefinition();
    myScriptResDef.Path = "~/Scripts/jquery-2.0.3.min.js";
    myScriptResDef.DebugPath = "~/Scripts/jquery-2.0.3.js";
    myScriptResDef.CdnPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-2.0.3.min.js";
    myScriptResDef.CdnDebugPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-2.0.3.js";
    ScriptManager.ScriptResourceMapping.AddDefinition("jquery", null, myScriptResDef);

    Here is an article which describes how to use scriptmanager and global.asax to solve these issues - http://weblogs.asp.net/infinitiesloop/archive/2009/11/23/asp-net-4-0-scriptmanager-improvements.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 18, 2013 2:51 AM

All replies

  • User-1360095595 posted

    Maybe your host provider is injecting it, for one reason or another. Some you can't find any reference to it in your solution, I mean. 

    Tuesday, October 8, 2013 9:22 AM
  • User1889380885 posted

    The host provider is the Azure portal. I'm not sure why they would add it on some pages only. 

    Is it possible that the asp:CreateUserWizard is adding this reference for some reason?

    Best regards

    Tuesday, October 8, 2013 11:06 AM
  • User1889380885 posted

    This was caused by a dll which was loading an older version of jQuery.

    I solved this by putting the following in global.asax which makes sure all jquery references are pointing to the same place:

    // Override JuiceUI mappings of JQuery
    ScriptResourceDefinition myScriptResDef = new ScriptResourceDefinition();
    myScriptResDef.Path = "~/Scripts/jquery-2.0.3.min.js";
    myScriptResDef.DebugPath = "~/Scripts/jquery-2.0.3.js";
    myScriptResDef.CdnPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-2.0.3.min.js";
    myScriptResDef.CdnDebugPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-2.0.3.js";
    ScriptManager.ScriptResourceMapping.AddDefinition("jquery", null, myScriptResDef);

    Here is an article which describes how to use scriptmanager and global.asax to solve these issues - http://weblogs.asp.net/infinitiesloop/archive/2009/11/23/asp-net-4-0-scriptmanager-improvements.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 18, 2013 2:51 AM