关于较新版本JQUERY的Load方法会为页面引用文件自动附加时间戳参数阻止它缓存的解决方案.
2016-10-27 09:34
561 查看
// More options handling for requests with no content
if (!s.hasContent) {
// If data is available, append data to url
if (s.data) {
cacheURL = (s.url += (rquery.test(cacheURL) ? "&" : "?") + s.data);
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add anti-cache in url if needed
if (s.cache === false) {
s.url = rts.test(cacheURL) ?
// If there is already a '_' parameter, set its value
cacheURL.replace(rts, "$1_=" + nonce++) :
// Otherwise add one to the end
cacheURL + (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++;
}
}
红色部分便是附加参数反缓存的代码,更改一下即可. 不明白为什么JQ强制加入这个,Load方法也不可以传参来改变 cache的值为True
if (!s.hasContent) {
// If data is available, append data to url
if (s.data) {
cacheURL = (s.url += (rquery.test(cacheURL) ? "&" : "?") + s.data);
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add anti-cache in url if needed
if (s.cache === false) {
s.url = rts.test(cacheURL) ?
// If there is already a '_' parameter, set its value
cacheURL.replace(rts, "$1_=" + nonce++) :
// Otherwise add one to the end
cacheURL + (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++;
}
}
红色部分便是附加参数反缓存的代码,更改一下即可. 不明白为什么JQ强制加入这个,Load方法也不可以传参来改变 cache的值为True
相关文章推荐
- 关于页面不包含"事件_Click"的定义 并且找不到可接受页面类型的第一个参数的扩展方法"事件_Click" 的解决方案
- jquery中的load方法加载页面无法缓存问题
- 关于使用ASP实现文件缓存的解决方案
- 应用MasterPage的页面引用外部CSS文件的方法
- 当jsp文件放在某个文件夹下时jquery的$.ajax方法失效的--解决方案
- Asp.net页面中引用js文件无效的问题的解决方法
- defer属性导致引用JQuery的页面报“浏览器无法打开网站xxx,操作被中止”错误的解决方法
- XML,Dictionary的应用---有关于页面之间接收和传递参数的又一解决方案 [原创]
- 附加自动命名的数据库,但失败。已存在同名的数据库,或指定的文件无法打开或位于 UNC 共享目录中[解决方法]
- defer属性导致引用JQuery的页面报“浏览器无法打开网站xxx,操作被中止”错误的解决方法
- 关于引用js文件中出现乱码问题的解决方案
- 防止jQuery Load使用缓存的方法
- 关于页面缓存清除的方法小结
- 禁止JQuery中的load方法装载IE缓存中的文件
- 使用jquery的load()方法实现页面局部刷新
- 应用MasterPage的页面引用外部CSS文件的方法
- 关于页面缓存清除的方法小结(整理)
- 关于在FireFox 3.0 中showModalDialog的页面刷新window.dialogArguments引用丢失的解决方法
- Asp.net页面中引用js文件无效的问题的解决方法
- 禁止jQuery Load使用缓存的方法