我的 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"
));
}
}