javascript - Is there another way to disable cache when fetching script? -
i use fetch script;
$.getscript("http://www.example.org/");
however, dont want cached. means if use getscript again, script should fetch again.
this 1 works in theory;
$.getscript("http://www.example.org/?" + math.random());
but in practically, it's not. because "?" disabled on remote site url, question is, there otherway tell browser not cache ?
recreate function needs:
(function () { $.getscript = function(url, callback) { $.ajax({ type: "get", url: url, success: callback, datatype: "script", cache: false }); }; })();
now won't cache anymore when call function like
$.getscript('script.js', function() { // non cached script.js });
Comments
Post a Comment