我想在加载脚本时禁用时间戳,因为它始终在文件 URL 之后的查询字符串中包含时间戳。请看图你就知道了。
我还使用选项 cache: true
设置了 Ajax。请参阅此处的代码:
``js
$.ajax({
网址: 网址
数据: {},
类型:'帖子',
缓存:真,
数据类型:'json',
成功:函数(数据,状态){
//这里有东西
}
});
and also I have set meta tag to the header of the HTML.
```html
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Pragma" content="Public">
<meta http-equiv="Cache-control" content="public">
<meta name="keywords" content="something">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
我正在使用 jQuery v1.7.2
最佳答案
我不确定为什么 jQuery 试图加载自身,但这似乎与 $.getScript()
调用有关。
您可以考虑将以下代码段添加到尽可能高的位置:
$.ajaxSetup({
cache: true
});
将 cache: true
放入 $.ajax()
中不会以任何方式影响 $.getScript()
,这就是您在屏幕截图中看到的内容。
关于php - 禁用带有时间戳的加载脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11962750/