开发者

Are Dynamically Loaded Files Cached by the Browser?

I have a question that is related to this answer, $.getScript(开发者_JS百科filename)

Are dynamically loaded files cached by the browser?

If not, how can I force them to be?


It seems that they are not. Proposed workaround is to redefine the function:

$.getScript = function(url, callback, cache) {
    $.ajax({
        type: "GET",
        url: url,
        success: callback,
        dataType: "script",
        cache: cache
    });
};

which could be used like this:

$.getScript('/foo.js', function() { }, true);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜