简体   繁体   English

禁用jQuery for Internet Explorer 8中的缓存问题

[英]Disable caching issue in jQuery for Internet Explorer 8

I am unable to view new search results as they are updated in the database. 我无法查看新的搜索结果,因为它们已在数据库中更新。 Only using Internet Explorer 8. I tried refreshing the page but that does nothing. 仅使用Internet Explorer8。我尝试刷新页面,但没有执行任何操作。 Chrome and Firefox work fine. Chrome和Firefox可以正常工作。

I am able to temporarily resolve this issue by choosing "Check for new versions of the stored page : Every time I visit the webpage". 通过选择“检查存储页面的新版本:每次访问该网页”,我可以暂时解决此问题。 However, as I move this into production this means it won't work for end users using IE 8 9 or 10. 但是,当我将其投入生产时,这意味着它对于使用IE 8 9或10的最终用户将不起作用。

Any helpful tips are appreciated. 任何有用的提示表示赞赏。 Thanks in Advance. 提前致谢。

Here is what I have already tried: 这是我已经尝试过的:

<script> type=“text/javascript" src="js/jquery-1.9.1.min.js?new=yes"></script>

$(document).ready(function () {
    //http://stackoverflow.com/questions/217957/how-to-print-debug-messages-in-the-google-chrome-javascript-console/2757552#2757552
    if (!window.console) console = {};
    console.log = console.log || function () {};
    console.dir = console.dir || function () {};

    //listen for keyup on the field

    $("#searchField").keyup(function () {
        //get and trim the value
        var field = $(this).val();

        field = $.trim(field)

        //if blank, nuke results and leave early

        if (field == "") {
            $("#results").html("");

            return;
        }

        console.log("searching for " + field);

        $.getJSON("cfc/test.cfc?returnformat=json&method=search", {
            "search": field
        }, function (res, code) {

            var s = "<table width='1000' class='gridtable' name='table1' border='1'><tr><th width='40'>Attuid</th><th width='80'>Device</th><th width='55'>Region</th><th width='140'>Problem</th><th width='160'>Description</th><th width='120'>Resolution</th> <th width='180'>Resolution Description</th><th width='40'>Agent</th><th width='140'>Timestamp</th></tr>";

            s += "";

            for (var i = 0; i < res.table_demo.length; i++) {
                s += "<tr><td width='42'>" + res.table_demo[i].pa_uid +
                    "</td><td width='80'>" + res.table_demo[i].pa_device +
                    "</td><td width='55'>" + res.table_demo[i].pa_region +
                    "</td><td width='140'> " + res.table_demo[i].pa_problem +
                    "</td><td width='160'> " + res.table_demo[i].pa_description +
                    "</td><td width='120'>" + res.table_demo[i].pa_resolution +
                    "</td><td width='180'>" + res.table_demo[i].pa_rdescription +
                    "</td><td width='42'> " + res.table_demo[i].pa_agent +
                    "</td><td width='140'> TimeStamp"
                "</td>";

                s += "</tr>";
            }

            s += "</table>";

            $("#results").html(s);
        });
    });
})

Try $.ajaxSetup({ cache: false }); 尝试$.ajaxSetup({ cache: false }); so disable jQuery caching. 因此禁用jQuery缓存。

Also to expire pages instantly, try adding meta tags: 另外,要立即使页面过期,请尝试添加元标记:

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

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

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