0

我的 ASP MVC 页面不断请求 /scripts/jquery-1.7.2,但仅当我在某些页面中单击“返回”时。我不知道为什么。该文件不存在,因此出现“未定义 jquery”错误。

  • 我已经从 Nuget 卸载了与 JQuery 相关的所有内容
  • 我已经对包含文本“jquery-1.7*”的所有文件进行了 Windows 文件搜索。只有某些 JS 库中的注释包含文本。
  • 我已经删除了所有与 JQuery 相关的旧文件
  • 我已经清理了项目并删除了其中的 ~/obj/ 和 ~/bin/ 目录。
  • 我已经从我的 BundleConfig 中删除了任何提及

作为该项目一部分的实际脚本文件:

项目中包含的实际脚本文件(目录内容相同)

我的 HTML 部分(略微修剪)

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

我的捆绑配置:

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 的问题“你清除浏览器缓存了吗?”有点正确。浏览器缓存是问题,但我必须用 CCleaner 清除它。IE 的“安全 --> 删除浏览历史记录(☑ 检查所有内容)”由于某种原因不起作用。我什至手动杀死了所有 IE 进程,以防崩溃的进程锁定某些文件。

我也曾在 Firefox 中尝试过,当我第一次访问该页面时,出于某种原因,它做了同样的事情,但是“CTRL+F5”在 IE 中正常工作并解决了问题。

我有 +1 的 Mac Attack 的问题。

今天的教训:IE9 的缓存清除显然不起作用,至少在这种情况下是这样。

于 2012-09-19T00:31:39.737 回答