Javascript文件缓存问题
Javascript file caching issue
我遇到了一个非常奇怪的问题,我无法找到根源。
我有一个正确加载并执行的文件:main.js,代码为:
$(function() {
$('.navigation a').click(function(ev) {
currentTab = $(this).find('.active');
newTab = $(this).attr('name');
$('.active').removeClass('active');
$(this).addClass('active');
});
});
这非常有效。但是如果我把代码改成:
$(function() {
$('.navigation a').click(function(ev) {
currentTab = $(this).find('.active');
newTab = $(this).attr('name');
newTab = $(this).attr('name');
newTab = $(this).attr('name');
newTab = $(this).attr('name');
newTab = $(this).attr('name');
$('.active').removeClass('active');
$(this).addClass('active');
});
});
当我直接通过浏览器查看文件时,它会恢复为:
$(function() { $('.navigation a').click(function(ev) { currentTab = $(this).find('.active'); newTab = $(this).attr('name'); console.log(currentTab); console.log(currentTab); console.log(currentTab); $('.active').removeClass('active'); $(this).addClass('active'); });});
������������������������������������������������������������������������������
控制台日志错误为:
未捕获的SyntaxError:意外的令牌ILLEGAL(第2行)
它工作得很好,但似乎一旦我中断了一定数量的行,它就会损坏并恢复到旧的缓存文件。根据我自己的测试,如果文件总共有12行,它就可以工作了。如果它大于12,则会断开,如上所示。
我试过:
CTRL+F5
隐姓埋名
3种不同的浏览器
2 IDE的
重新启动我的计算机
已清除缓存,已禁用缓存。
完全迷路了,有什么建议吗?谢谢你抽出时间。
我找到了问题的原因。
/etc/httpd/conf/httpd.conf
有一条线路
#启用发送文件关闭
这一行必须取消注释。
相关文章:
- ReactJS和SpringDataRest缓存问题可能与websocket有关
- 登录后重定向,缓存页面问题-Javascript
- jQuery选择器缓存问题
- Express/Node的奇怪(缓存)问题
- Node.js/Socket.io适用于除Firefox之外的所有应用程序,这可能是缓存问题
- 将部分视图加载到JQuery对话框中的缓存问题
- 防止在php中缓存500内部错误页面的问题
- 我的网站存在火狐缓存问题
- 禁用 Internet Explorer 8 jQuery 中的缓存问题
- 发送 XMLHttpRequest 时缓存结果的问题
- IE7中的JS +缓存问题
- Internet Explorer Ajax 调用,缓存响应问题
- 问题:在传递给函数时缓存 jquery 对象
- 浏览器中的 Ajax 缓存问题
- $('#textboxId').val() 返回旧值(浏览器缓存问题)
- Gulp Angular 构建模板缓存问题
- JSONP 从 WCF 服务获取缓存响应时出现问题
- jQuery Datatable缓存图像问题
- Javascript文件缓存问题
- 第二页加载时出现Safari缓存问题