简体   繁体   English

jquery 1.11 选项卡禁用缓存不起作用

[英]jquery 1.11 tabs disable cache not working

I have migrated from jquery 1.8.4 to 1.11, since then having issue with the cache behaviours in IE 11.我已经从 jquery 1.8.4 迁移到 1.11,从那时起就遇到了 IE 11 中的缓存行为问题。

In 1.8.4 to disable cache I used which worked pretty well在 1.8.4 中禁用缓存我使用的效果很好

var $tabs = $('#tabs').tabs({ajaxOptions: { cache: false }

But now as cache property is no longer supported the data is always loaded from the cache.但是现在由于不再支持缓存属性,数据总是从缓存中加载。 I have changed the code but no effect.我已经更改了代码但没有效果。 This works in Firefox but not in IE这适用于 Firefox 但不适用于 IE

var $tabs = $('#tabs').tabs({ajaxOptions: { cache: false },
    beforeLoad: function( event, ui ) {
        if ( ui.tab.data( "loaded" ) ) {
            event.preventDefault();
            return;
        }
        ui.jqXHR.success(function() {
            ui.tab.data( "loaded", true );
        });
    }
}); 
beforeLoad: function( event, ui ) {
            var link = $(ui.tab).find("a").attr("href");
            var index = link.lastIndexOf("?"); 
            var timestamp = Date.now();
            if(index > 0) {
                link = link.substring(0, index);  
            }
            link = link + "?ts_=" +  timestamp;
            ui.ajaxSettings.url = link;

        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM