Javascript文件缓存问题

时间:2013-08-26 19:05:35

标签: javascript caching token

我有一个令人难以置信的奇怪问题,我无法找到它的根源。

我的文件: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的

  • 重新启动我的电脑

  • 清除缓存,禁用缓存。

绝对丢失,有什么建议吗?感谢您的时间。

1 个答案:

答案 0 :(得分:0)

我找到了问题的原因。

  

/etc/httpd/conf/httpd.conf中

有一行

  

#EnableSendfile off

此行必须取消注释。