0

My ASP MVC page keeps requesting /scripts/jquery-1.7.2, but only when I click "back" in certain pages. I have no idea why. That file does not exist, so I get "jquery is not defined" errors.

  • I've uninstalled everything related to JQuery from Nuget
  • I've done a Windows file search for all files containing the text, "jquery-1.7*". Only comments in certain JS libraries contain the text.
  • I've deleted every old JQuery-related file
  • I've cleaned the project and deleted the ~/obj/ and ~/bin/ directories within.
  • I've removed any mention from my BundleConfig

Actual script files as part of this project:

Actual script files included in project (directory contents are the same)

My HTML section (slightly trimmed)

<head>
    <meta charset="utf-8" />
    <title>Foo</title>
    <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />

    <script type="text/javascript">         var myRootDir = '/';</script>

    <!--Problem here: Should not be loading these individual jqueryui files because they aren't in BundleConfig-->
    <link href="/Content/themes/base/jquery.ui.core.css" rel="stylesheet" type="text/css" />
    <!--Trimmed...-->
    <link href="/Content/themes/base/jquery.ui.theme.css" rel="stylesheet" type="text/css" />

    <link href="/Content/site.css" rel="stylesheet" type="text/css" />
    <link href="/Content/demo_table_jui.css" rel="stylesheet" type="text/css" />
    <link href="/Content/TableTools.css" rel="stylesheet" type="text/css" />
    <link href="/Content/TableTools_JUI.css" rel="stylesheet" type="text/css" />

    <!--Problem here: Where is this from?! -->
    <script src="/Scripts/jquery-1.7.2.js" type="text/javascript"></script>

    <script src="/Scripts/jquery-ui-1.8.20.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.dataTables.js" type="text/javascript"></script>
    <script src="/Scripts/ZeroClipboard.js" type="text/javascript"></script>
    <script src="/Scripts/TableTools.js" type="text/javascript"></script>
    <script src="/Scripts/dataTables.editor.js" type="text/javascript"></script>
    <meta name="viewport" content="width=device-width" />
</head>

My BundleConfig:

public class BundleConfig
{
    public static void RegisterBundles(BundleCollection bundles) {
        bundles.Add(
            new ScriptBundle("~/bundles/jquery").Include(
                "~/Scripts/jquery-1.*"
            )
        );

        bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                    "~/Scripts/jquery-ui*"));

        bundles.Add(new ScriptBundle("~/bundles/dataTables").Include(
                    "~/Scripts/jquery.dataTables*",
                    "~/Scripts/ZeroClipboard*",
                    "~/Scripts/TableTools.*",
                    "~/Scripts/dataTables.editor.*"
                    ));


        bundles.Add(new StyleBundle("~/Content/css").Include(
            "~/Content/site.css",
            "~/Content/demo_table_jui.css",
            "~/Content/TableTools.css",
            "~/Content/TableTools_JUI.css"
            ));
    }
}
4

1 に答える 1

0

Mac Attack's question, "Have you cleared browser cache?", was sort of right. The browser cache was the problem, but I had to clear it with CCleaner. IE's "Safety --> Delete Browsing History (☑ checked everything)" did not work for some reason. I had even manually killed all IE processes just in case a crashed process was locking certain files.

I had also tried it in Firefox which did the same thing for some reason when I first visited the page, but a "CTRL+F5" worked as it should have in IE and cleared up the problem.

I've +1's Mac Attack's question.

Lesson for today: IE9's cache clear apparently does not work, at least in this case.

于 2012-09-19T00:31:39.737 に答える