admin管理员组

文章数量:1221291

I'm developing a website. But it caches user name and password in cache block which can be accessed using hacking software like winhex. I want to clear cache

$(".object-position").livequery("change", function() {
    $("#objects-list input").attr('disabled', true);
    var action = $(this).attr('name');
    var position = $(this).attr('value');
    var id = $(this).attr("id");
    var model = id.split("-")[0];
    var object_id = id.split("-")[1];

    $("#loader").show();
    $("#loader").fadeIn(200);

    $.ajax({
        type: "POST",
        async: true,
        url: "/manage/update_position/",
        data: "action=" + action + "&model=" + model + "&object_id=" + object_id + "&position=" + position,
        dataType: "json",
        success: function(data){
            $("#loader").fadeOut("fast", function () {
                $("#loader").hide();
            });
            $("objects-list").html(data["html"]);
            $("#message").show();
            $("#message").fadeIn(400).html('<span>'+data["message"]+'</span>');
            setTimeout(function(){
                $("#message").fadeOut("slow", function () {
                    $("#message").hide();
                });
            }, 1500); 
        }
    });
    $("#objects-list input").attr("disabled", false);
    return false;
});

I'm developing a website. But it caches user name and password in cache block which can be accessed using hacking software like winhex. I want to clear cache

$(".object-position").livequery("change", function() {
    $("#objects-list input").attr('disabled', true);
    var action = $(this).attr('name');
    var position = $(this).attr('value');
    var id = $(this).attr("id");
    var model = id.split("-")[0];
    var object_id = id.split("-")[1];

    $("#loader").show();
    $("#loader").fadeIn(200);

    $.ajax({
        type: "POST",
        async: true,
        url: "/manage/update_position/",
        data: "action=" + action + "&model=" + model + "&object_id=" + object_id + "&position=" + position,
        dataType: "json",
        success: function(data){
            $("#loader").fadeOut("fast", function () {
                $("#loader").hide();
            });
            $("objects-list").html(data["html"]);
            $("#message").show();
            $("#message").fadeIn(400).html('<span>'+data["message"]+'</span>');
            setTimeout(function(){
                $("#message").fadeOut("slow", function () {
                    $("#message").hide();
                });
            }, 1500); 
        }
    });
    $("#objects-list input").attr("disabled", false);
    return false;
});
Share Improve this question edited Apr 20, 2017 at 11:29 user688 3613 silver badges23 bronze badges asked Apr 20, 2017 at 10:07 Amit GujarathiAmit Gujarathi 1,1001 gold badge13 silver badges25 bronze badges 5
  • On deleting your browser's cache will remove this. And remove saved passwords. – Rohan Kumar Commented Apr 20, 2017 at 10:08
  • but i wanna do it programatically – Amit Gujarathi Commented Apr 20, 2017 at 10:09
  • 1 autocomplete=off ;) – Tushar Gupta Commented Apr 20, 2017 at 10:09
  • how about adding headers for not saving cache? – Jurij Jazdanov Commented Apr 20, 2017 at 10:10
  • its not working for my website – Amit Gujarathi Commented Apr 20, 2017 at 10:11
Add a comment  | 

1 Answer 1

Reset to default 13

This meta code should work with most browsers for web content. However, for resource files (javascript, images, css) your mileage may vary. Most cache busting strategies involve changing the name of your resource files (perhaps dynamically) or using Apache rewrite rules to pretend that the names are changed. This google search should put you on the right track.(cache busting strategy for js)

<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />

本文标签: javascriptHow to clear cache memory on load of HTML pageStack Overflow