Expires,last-modified code implementation

for example, the title is a cached resource, how to actually operate it?

<link rel="stylesheet" href="build/css/ui-box.css">
<script src="common/comm.js" type="text/javascript" charset="utf-8"></script>

function ajaxPostQuery(url, paramJsonStr, func, dataType) {
    var dataType = dataType || "json";
    var url = url || queryUrl;
    var sid = appcan.locStorage.getVal("sid");

    $.ajax({
        type : "POST",
        url : url,
        data : paramJsonStr + "&sid=" + sid,
        headers : {
            accept : "*/*"
        },
        //contentType:"application/x-www-form-urlencoded",
        dataType : dataType,
        timeout : 0,
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            appcan.window.alert("", "", "");
        },
        success : function(data) {
            var errorData;
            if ( typeof data == "string") {
                try {
                    errorData = eval("(" + data + ")");

                    if (errorData.error == "-1") {
                        //alert(url);
                        relogin(url);
                    } else {
                        func(data);
                    }
                } catch(e) {
                    func(data);
                }
            }
        }
    });
}

read too much soft text, ask for advice on how to do it.

Feb.26,2021

  1. expires is the expiration time returned by the server to the browser. Before the expiration time, the browser requests resources to be fetched directly from the local server and will not reach the server
  2. last-modified is returned to the browser by the server, and subsequent requests of the browser will be accompanied by If-Modified-Since . The server verifies whether the resource expires according to this header. If it does not expire, it returns 304 to the browser, and the browser directly takes the local content. Otherwise, the content is returned directly
  3. .
Menu