Ajax 返回到某个页面将显示原始页面

Ajax 返回到某个页面将显示原始页面,ajax,caching,Ajax,Caching,如果我向用户提供页面,例如: <!DOCTYPE HTML> <HTML> <HEAD> <SCRIPT type="text/javascript"> function cbCountry_Click() { var select = document.getElementById("cbCountry"); select.options[select.op

如果我向用户提供页面,例如:

<!DOCTYPE HTML>
<HTML>
<HEAD>
    <SCRIPT type="text/javascript">
        function cbCountry_Click()
        {
            var select = document.getElementById("cbCountry");

            select.options[select.options.length] = new Option("Canada", "CA");
            select.options[select.options.length] = new Option("United States", "US");
        }​
    </SCRIPT>
</HEAD>
<BODY>
    <SELECT id="cbCountry"></SELECT>
    <P><BUTTON onclick="cbCountry_Click()">Get Countries</BUTTON>
    <P><A href="http://google.com">Visit a link</A>
</BODY>
</HTML>

阻止缓存页面。这样做的缺点是它会阻止页面被缓存。

您可以使用cookie在客户端存储状态,并在加载页面时从cookie恢复页面的状态

Cache-Control: nocache